上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 19 下一页
摘要: 这里的csv文件如果在Python解释器中打开的话是乱码的,把文件复制出来用excel打开就正常了。 阅读全文
posted @ 2019-06-24 20:20 乔儿 阅读(683) 评论(0) 推荐(0) 编辑
摘要: a = {"name":'qiliyan','sex':'man'} print(tuple(a.keys())) #('name', 'sex') print(tuple(a.values())) #('qiliyan', 'man') for key in a.keys(): print(key) #name #sex for value in a.values(): pri... 阅读全文
posted @ 2019-06-24 16:04 乔儿 阅读(14078) 评论(0) 推荐(1) 编辑
摘要: 在中间件里面写,然后在设置里面的爬虫中间件(SPIDER_MIDDLEWARES)里面打开 阅读全文
posted @ 2019-06-22 17:18 乔儿 阅读(1736) 评论(0) 推荐(0) 编辑
摘要: from scrapy.http import Request,FormRequest def start_requests(self): return [Request('http://www.com/login.htm', meta={'cookiejar': 1}, callback=self.parse)] def parse(self, response)... 阅读全文
posted @ 2019-06-19 10:28 乔儿 阅读(543) 评论(0) 推荐(0) 编辑
摘要: encode('utf-8').decode('unicode_escape') 阅读全文
posted @ 2019-06-15 15:51 乔儿 阅读(790) 评论(0) 推荐(0) 编辑
摘要: import urllib,requests a = "height%22%3A40%2C%22urldecode转中文" b = urllib.parse.unquote(a) print(b) c = "中文转urlencode" d = urllib.parse.quote(c) print(d) 阅读全文
posted @ 2019-06-15 11:32 乔儿 阅读(1241) 评论(0) 推荐(0) 编辑
摘要: # coding=gbk 阅读全文
posted @ 2019-06-08 14:58 乔儿 阅读(884) 评论(0) 推荐(0) 编辑
摘要: import requestsurl = "https://aip.baidubce.com/oauth/2.0/token"data = { 'grant_type':'client_credentials', 'client_id':API Key, 'client_secret':Secret 阅读全文
posted @ 2019-06-08 14:04 乔儿 阅读(3292) 评论(0) 推荐(0) 编辑
摘要: 这里的参数必须为bytes类型 阅读全文
posted @ 2019-06-07 17:14 乔儿 阅读(188) 评论(0) 推荐(0) 编辑
摘要: 该问题的原因是:因为网址使用了https,所以经过代理时会报错。报错原因是:Python3之关闭SSL证书验证 解决办法是:关闭验证SSL证书开关,verify:Ture/False,默认是Ture,用于验证SSL证书开关。例如:requests.get(url=url,headers=header 阅读全文
posted @ 2019-06-06 15:47 乔儿 阅读(14813) 评论(1) 推荐(3) 编辑
上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 19 下一页