摘要: #json 将json数据转化为字典,方便操作数据 res = requests.get('http://httpbin.org/get') print(res.json()) #res.json()返回的是字典 print(type(res.json())) 阅读全文
posted @ 2019-01-14 19:36 山…隹 阅读(1231) 评论(0) 推荐(0)
摘要: res = requests.get('http://soso3.gtimg.cn/sosopic/0/11129365531347748413/640') # print(res.content) with open('img/test.jpg','wb') as f: f.write(res.content) 阅读全文
posted @ 2019-01-14 19:29 山…隹 阅读(571) 评论(0) 推荐(0)
摘要: html中若有编码 在html中Ctrl+f 搜索charset查看网站的编码方式 然后res.encoding=。。。 加上编码格式,再打印 阅读全文
posted @ 2019-01-14 19:22 山…隹 阅读(237) 评论(0) 推荐(0)
摘要: import requests # 代理 # proxy = { # 'http':'http://182.61.29.114.6868' # } # res = requests.get('http://httpbin.org/ip',proxies = proxy) # print(res.text) ################# #取消重定向 # res = requests... 阅读全文
posted @ 2019-01-14 19:13 山…隹 阅读(185) 评论(0) 推荐(0)
摘要: import requests # get实例 # res = requests.get('http://httpbin.org/get') # # res.encoding='utf-8' # print(res.encoding) #编码格式 # print(res.text)#获取文本 ##################### #post实例 # info = { # ... 阅读全文
posted @ 2019-01-14 18:45 山…隹 阅读(141) 评论(0) 推荐(0)