Python爬虫学习(单线程爬虫(一))

来源:互联网 发布:带数据统计的二维码 编辑:程序博客网 时间:2024/05/21 11:17
import requestsimport reimport sysreload(sys)sys.setdefaultencoding("gb18030")type = sys.getfilesystemencoding()headers = {'User-Agent':'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 UBrowser/5.5.10106.5 Safari/537.36'}html = requests.get('http://jp.tingroom.com/yuedu/yd300p/',headers = headers)html.encoding = 'utf-8'#print html.text# Japanese = re.findall('color:#666666;">(.*?)</span>',html.text,re.S)# for each in Japanese:#     print eachchinese = re.findall('color: #039;">(.*?)</a>',html.text,re.S)for each in chinese:    print each

0 0
原创粉丝点击