2020年3月13日
摘要: 协程提取上海人民法院网站信息: import gevent import gevent.monkey import selenium import selenium.webdriver import urllib.request from bs4 import BeautifulSoup impor 阅读全文
posted @ 2020-03-13 03:20 共感的艺术 阅读(155) 评论(0) 推荐(0)
摘要: 协程原理: def go(): print(1) yield(1) #生成器 print(11) yield(11) print(111) yield (111) my=go() #分段执行 print(type(my)) print(next(my)) 协程案例切换: import greenle 阅读全文
posted @ 2020-03-13 03:18 共感的艺术 阅读(162) 评论(0) 推荐(0)
摘要: str转json: import json #json字符串,js类型跟字符串有关系,平时最多是字典 mydict='{"name":"yincheng","QQ":["758564524","1234"]}' #dict mydict='[1,2,3,4,5,6]' #list print( js 阅读全文
posted @ 2020-03-13 03:13 共感的艺术 阅读(2997) 评论(0) 推荐(0)
摘要: pyquery遍历与获取数据: #coding:utf-8 import pyquery doc=pyquery.PyQuery(filename="index.html") print(doc(".item-0.active")) #一个节点; #.表示class名称; #.active .替换了 阅读全文
posted @ 2020-03-13 03:08 共感的艺术 阅读(689) 评论(0) 推荐(0)
摘要: pyquery的简单用途: import pyquery html=""" <html> <title>这是标题</title> <body> <p id="hi">Hello</p> <ul> <li>list1</li> <li>list2</li> </ul> </body> </html> 阅读全文
posted @ 2020-03-13 03:06 共感的艺术 阅读(277) 评论(0) 推荐(0)
摘要: requests的cookie操作,cookie自动化 一、requests的cookie操作: import requests user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)' #模拟一个计算机 headers={'User 阅读全文
posted @ 2020-03-13 03:03 共感的艺术 阅读(712) 评论(0) 推荐(0)
摘要: requests文件_json: #coding:utf-8 import requests import json #url="http://httpbin.org/post" #data textfile newurl="http://pythonscraping.com/pages/proce 阅读全文
posted @ 2020-03-13 03:00 共感的艺术 阅读(154) 评论(0) 推荐(0)
摘要: selenium登录csdn,urllib抓取数据: import selenium import requests import selenium.webdriver import selenium.webdriver.common.keys import time #需要手动滑动验证码 driv 阅读全文
posted @ 2020-03-13 02:53 共感的艺术 阅读(283) 评论(0) 推荐(0)
摘要: selenium登录12306,requests抓取数据: import selenium import selenium.webdriver import selenium.webdriver.common.keys from selenium.webdriver.common.action_ch 阅读全文
posted @ 2020-03-13 02:52 共感的艺术 阅读(330) 评论(0) 推荐(0)
摘要: selenium登录淘宝,requests抓取购物车: import selenium import selenium.webdriver import selenium.webdriver.common.keys import requests import lxml import lxml.et 阅读全文
posted @ 2020-03-13 02:50 共感的艺术 阅读(736) 评论(0) 推荐(0)
摘要: selenium登录京东,requests抓取购物车: import selenium import selenium.webdriver import selenium.webdriver.common.keys import requests import lxml import lxml.et 阅读全文
posted @ 2020-03-13 02:49 共感的艺术 阅读(612) 评论(0) 推荐(0)
摘要: requests抓取json判断IP所在地: import requests import requests.auth #auth 代表登录 req=requests.get("https://api.ip2country.info/ip?113.88.65.106",verify=False) # 阅读全文
posted @ 2020-03-13 02:48 共感的艺术 阅读(231) 评论(0) 推荐(0)
摘要: requests登录路由器: import requests import requests.auth #auth 代表登录 #路由器在登录的时候会在网页 弹出一个框 让输入用户名和密码 #登录路由器 auth=requests.auth.HTTPBasicAuth("ryan","password 阅读全文
posted @ 2020-03-13 02:47 共感的艺术 阅读(360) 评论(0) 推荐(0)