摘要: import urllib.parse 如: url = 'https://www.baidu.com/index?name=xiaoming&age=20' #将标准的url进行编码res = urllib.parse.quote(url) print(res) #结果https%3A//www. 阅读全文
posted @ 2018-06-04 09:28 莫问丶过往 阅读(135) 评论(0) 推荐(0) 编辑
摘要: import urllib.request url = 'http://www.baidu.com/'response = urllib.request.urlopen(url=url) print(response.read().decode()) #默认utf8解码 #直接解码有可能会出现下图错 阅读全文
posted @ 2018-06-04 09:25 莫问丶过往 阅读(110) 评论(0) 推荐(0) 编辑
摘要: import json,codecsdef readjson(file): with open(file,'rb') as fp: data = json.load(fp) return datalist1 = []loadjson = readjson('market.json')profile 阅读全文
posted @ 2018-05-21 10:41 莫问丶过往 阅读(1724) 评论(0) 推荐(0) 编辑