摘要: from selenium import webdriverfrom selenium.webdriver import ActionChainsimport timefrom PIL import Imageimport random def cut_image(driver): #获取整个页面图 阅读全文
posted @ 2019-06-21 18:25 ...下雨不打伞 阅读(136) 评论(0) 推荐(0)
摘要: '''Xpath语法'''from selenium import webdriver driver = webdriver.Chrome()try: # 隐式等待:卸载get请求前面 driver.implicitly_wait(10) driver.get('https://doc.scrapy 阅读全文
posted @ 2019-06-21 18:24 ...下雨不打伞 阅读(156) 评论(0) 推荐(0)
摘要: 作业1: from selenium import webdriverimport time#获取驱动对象driver = webdriver.Chrome()try: #自动登陆抽屉新热榜 #发送get请求 driver.get('https://dig.chouti.com/ ') #隐式等待 阅读全文
posted @ 2019-06-21 18:21 ...下雨不打伞 阅读(152) 评论(0) 推荐(0)
摘要: 爬取豆瓣250 import requestsimport reurl = 'https://movie.douban.com/top250'headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537 阅读全文
posted @ 2019-06-17 22:32 ...下雨不打伞 阅读(192) 评论(0) 推荐(0)
摘要: # 1:time # import time # print(time.time()) # #等待2s # time.sleep(2) # print(time.time()) #2 os模块 # sys模块 # import os # #可以与操作系统中的文件进行交互 # #判断文件路径是否存 # 阅读全文
posted @ 2019-06-14 08:10 ...下雨不打伞 阅读(133) 评论(0) 推荐(0)
摘要: def login(): count = 0 while True: if count != 3: users = input('请输入用户名:').strip() pwds = input('请输入密码:').strip() user = '' pwd = '' dict = {} with op 阅读全文
posted @ 2019-06-12 21:40 ...下雨不打伞 阅读(98) 评论(0) 推荐(0)
摘要: 字符串内置方法 # # 字符串的操作str1 = 'my name is xxx, my age is 18。' # # 优先掌握的操作:# # 1、按索引取值(正向取+反向取) :只能取print(str1[3])## # 2、切片(顾头不顾尾,步长)print(str1[3:7]) # 3 - 阅读全文
posted @ 2019-06-11 23:13 ...下雨不打伞 阅读(70) 评论(0) 推荐(0)