2019年9月21日

urllib.request encode()/decode()

摘要: urllib.request urlopen(url)#直接打开相应的url urlretrieve(url,image_path)#打开url直接将图片存储,后面为图片存储地址 encode()/decode()小括号里面不写参数,默认是utf8,写只能写gbk。 阅读全文

posted @ 2019-09-21 21:27 ybl20000418 阅读(311) 评论(0) 推荐(0) 编辑

urllib.parse quote/unquate/urlencode

摘要: quote :url编码函数,将中文进行转化为%xxxx # _*_ coding::utf_8 _*_ import urllib.request import urllib.parse url='http://baidu.com/index.html?name=杨洪&pwd=123456' ret=urllib.parse.quote(url) ret1=urllib.parse.unqu... 阅读全文

posted @ 2019-09-21 21:23 ybl20000418 阅读(317) 评论(0) 推荐(0) 编辑

python 爬取图片

摘要: 得到url response=urllib.request.urlopen(url)打开获得的url response.read().decode()# decode()将读出的信息以二进制字节形式打开, 将获得的文件输出,有方法一,方法二、方法三可以直接进行传数 方法一: with open(r' 阅读全文

posted @ 2019-09-21 20:15 ybl20000418 阅读(108) 评论(0) 推荐(0) 编辑

导航