- 博客(5)
- 收藏
- 关注
转载 Python中 '\r' 的实际应用
1. 知识储备 \r 表示将光标的位置回退到本行的开头位置\b 表示将光标的位置回退一位 在 python 语言中, 使用 print 打印输出时,默认是会进行换行的。如何让其不换行呢? 在 python 2.x 中的语法是在 print 语句的末尾添加逗号,例如 print x, ;或者使用 sys.stdout.write() 对标准输出进行重定向,如此文所示 https://segme...
2018-11-12 23:57:50
613
原创 selenium操作
selenium模拟手机登陆: from selenium import webdriver import time """ selenium模拟手机登陆 """ # 设置 mobilesetting={"deviceName": "iPhone X"} chrome_options = webdriver.ChromeOptions() # 选项 chrome_options.add_...
2018-11-08 23:30:27
194
转载 随机请求User-Agent
fake-useragent python安装 pip install fake-useragent 使用方法: from fake_useragent import UserAgent ua = UserAgent() ua.ie # Mozilla/5.0 (Windows; U; MSIE 9.0; Windows NT 9.0; en-US); ua.msie # Mozil...
2018-11-07 00:52:19
425
原创 python 数据库操作 使用连接池
# 操作数据库存储数据是 IO 操作,IO操作比较消耗时间,所以可以异步操作 from twisted.enterprise import adbapi from pymysql.cursors import DictCursor from pymysql class JianshuTwistedSpiderPipeline(object): def __init__(self): ...
2018-11-06 18:06:22
1150
原创 Selenium 处理 Farme 框架代码
一,有的网页我们使用requests请求,返回的内容没有我们要的信息,然后你会发现返回的代码跟网页源代码是一毛一样(里头根本就没有我们想要的信息),而信息都在框架源代码中(网页内的网页),这时候我们想要获取信息就换方法。 二,使用Selenium里的switch_to.frame()方法:跳转到指定的框架 from selenium import webdriver from lxml impor...
2018-10-31 02:08:02
522
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人