
python
qq_14960889
这个作者很懒,什么都没留下…
展开
-
2.Python2跟Python3的区别
Python2跟Python3是不兼容的,在3中一些语法、内建函数和对象的行为有所调整。1.如果需要在Python2中写的代码能在Python3中使用,建议使用__future__模块2.print函数:Python3中print('hello'),Python2中为print hello3.unicode:Python2有基于ASCII的str()类型,可通过单独的unicode()函数转...原创 2020-04-20 23:35:16 · 136 阅读 · 0 评论 -
1.Python安装方法(windows、centos)
1、首先打开Python官网下载相应版本Python安装包。下载地址:https://www.python.org/找到对应需要版本的python安装包。以下我以Python3.6.2为例第一步需要将python添加到环境变量中去,免得手动添加,勾选后选择下进行下一步;选择安装路径即可完成安装。...原创 2020-04-20 23:19:13 · 286 阅读 · 1 评论 -
python如何查看安装路径
1、linux系统中默认路径:/usr/bin/env python 或者 usr/local/bin/python或者使用命令查找:whereis python 或者 which python2、windows中import syssys.path使用 python -V查看python版本号...原创 2019-01-09 17:23:37 · 3465 阅读 · 0 评论 -
ERROR: Could not find a version that satisfies the requirement selenium (from versions: none)
ERROR: Could not find a version that satisfies the requirement selenium (from versions: none)ERROR: No matching distribution found for selenium方法1:增大超时时间pip --default-timeout=100 install selenium方...原创 2019-10-02 11:22:34 · 16717 阅读 · 7 评论 -
爬虫训练二
爬虫训练二import reimport requestsfrom lxml import etreeimport global_varimport timeimport xlwt##申明类class title: contents = [] def get_domain(self): domain = [] with open('doma...原创 2019-10-02 12:15:16 · 165 阅读 · 0 评论 -
WebDriver操作cookie的方法
WebDriver操作cookie的方法WebDriver提供了操作Cookie的相关方法,可以读取、添加和删除cookie信息。WebDriver操作cookie的方法:get_cookies(): 获得所有cookie信息。get_cookie(name): 返回字典的key为“name”的cookie信息。add_cookie(cookie_dict) : 添加cookie。“co...原创 2019-10-04 23:47:18 · 889 阅读 · 0 评论 -
python3操作mysql数据库
python3import pymysqlimport typesdb=pymysql.connect(“localhost”,“root”,“123456”,“python”);cursor=db.cursor()#创建user表cursor.execute(“drop table if exists user”)sql=""“CREATE TABLE IF NOT EXISTS ...原创 2019-10-06 23:43:47 · 131 阅读 · 0 评论