随笔分类 -  python数据抓取

摘要:import timeimport requestsfrom bs4 import BeautifulSoupimport threadingdef format_str(s): return s.replace("\n","").replace("","").replace("\t",'')def 阅读全文
posted @ 2017-12-31 10:35 Justice-V 阅读(189) 评论(0) 推荐(0)
摘要:json import requestsimport jsonurl="https://sp0.baidu.com/5a1Fazu8AA54nxGko9WTAnF6hhy/su?wd=na&json=1&p=3&sid=1459_19036_21110_25227_25436_25178&req=2 阅读全文
posted @ 2017-12-29 23:00 Justice-V 阅读(799) 评论(0) 推荐(0)
摘要:查找网页中<a>标签中的链接from bs4 import BeautifulSoupwith open('beautifulSoup_test.html','r',encoding='utf-8')as f: #beautifulSoup_test.html是同级网页源代码 bs=Beautifu 阅读全文
posted @ 2017-12-29 14:38 Justice-V 阅读(372) 评论(0) 推荐(0)
摘要:import randomrandom.seed(20)print(random.random())random.seed(10) #random.seed()指定随机数,与下面的相同的种子值print(random.random())random.seed(20)print(random.rand 阅读全文
posted @ 2017-12-29 12:59 Justice-V 阅读(158) 评论(0) 推荐(0)