上一页 1 ··· 17 18 19 20 21 22 23 24 25 ··· 29 下一页
摘要: 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 山…隹 阅读(568) 评论(0) 推荐(0)
摘要: html中若有编码 在html中Ctrl+f 搜索charset查看网站的编码方式 然后res.encoding=。。。 加上编码格式,再打印 阅读全文
posted @ 2019-01-14 19:22 山…隹 阅读(235) 评论(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 山…隹 阅读(137) 评论(0) 推荐(0)
摘要: import urllib3 import re # 下载百度首页页面的所有图片 # 1. 找到目标数据 # page_url = 'http://image.baidu.com/search/index?tn=baiduimage&ct=201326592&lm=-1&cl=2&ie=gb18030&word=%CD%BC%C6%AC&fr=ala&ala=1&alatpl=others... 阅读全文
posted @ 2019-01-12 19:56 山…隹 阅读(936) 评论(0) 推荐(0)
摘要: import urllib3 import json # 实例化一个连接池 # http = urllib3.PoolManager() # res = http.request('get','http://httpbin.org/get') # res_json = res.data.decode() # res_dict = json.loads(res_json) # print(res... 阅读全文
posted @ 2019-01-08 22:02 山…隹 阅读(387) 评论(0) 推荐(0)
摘要: from urllib import request,parse # 1. 解析数据 # 解析一条 # response = request.urlopen(url='http://httpbin.org/get?username={}'.format(parse.quote('哈哈'))) # print(response.read()) # # 解析字典 # data1 = { # ... 阅读全文
posted @ 2019-01-08 21:39 山…隹 阅读(141) 评论(0) 推荐(0)
摘要: import socket import re client = socket.socket() # 图片url img_url = 'https://img03.sogoucdn.com/app/a/100520093/10e8b9550acde0b8-459f14f6a089053d-e879bbcb128a7b240716f9531571fc2c.jpg' # 构造报文 data = '... 阅读全文
posted @ 2019-01-08 19:12 山…隹 阅读(172) 评论(0) 推荐(0)
摘要: 1. mkvirtualenv -p /usr/bin/python3(python所在位置) Name(自定义环境名) 创建自定义虚拟环境 2. workon py3env(环境名) 进入环境 3. deactivate 退出虚拟环境 4. rmvirtualenv envname 删除虚拟环境 阅读全文
posted @ 2019-01-04 19:34 山…隹 阅读(259) 评论(0) 推荐(0)
摘要: Title 去百度 阅读全文
posted @ 2018-12-11 14:31 山…隹 阅读(242) 评论(0) 推荐(0)
上一页 1 ··· 17 18 19 20 21 22 23 24 25 ··· 29 下一页