摘要: 输出爬取的信息为乱码! 解决办法 爬取下来的编码是ISO 8859 1格式,需要转化为utf 8格式,加一句 response.encoding = "utf8" 阅读全文
posted @ 2018-06-02 23:53 amojury 阅读(359) 评论(0) 推荐(0) 编辑
摘要: ```python import re #常规匹配 content = 'Hello 1234567 World_This is a Regex Demo' #result = re.match('^Hello\s\d\d\d\s\d{4}\s\w{10}.*Demo$',content) #print(result.group()) #print(result.span()) #泛匹配 #r... 阅读全文
posted @ 2018-06-02 23:48 amojury 阅读(94) 评论(0) 推荐(0) 编辑
摘要: ```python import requests if __name__ == '__main__': #基本用法 #response = requests.get("http://httpbin.org/get") #print(response.text) #带参数的get #data = { # "name":"wu", ... 阅读全文
posted @ 2018-06-02 23:47 amojury 阅读(371) 评论(0) 推荐(0) 编辑