06 2019 档案

摘要:import timetime_tup = time.localtime(time.time())t1 = time.strftime('%Y%m%d%H', time_tup)if t1 <= time.strftime('%Y%m%d', time_tup) + '13': t = time.s 阅读全文
posted @ 2019-06-29 13:25 乔儿 阅读(319) 评论(0) 推荐(0) 编辑
摘要:这里的csv文件如果在Python解释器中打开的话是乱码的,把文件复制出来用excel打开就正常了。 阅读全文
posted @ 2019-06-24 20:20 乔儿 阅读(685) 评论(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 乔儿 阅读(14085) 评论(0) 推荐(1) 编辑
摘要:在中间件里面写,然后在设置里面的爬虫中间件(SPIDER_MIDDLEWARES)里面打开 阅读全文
posted @ 2019-06-22 17:18 乔儿 阅读(1742) 评论(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 乔儿 阅读(544) 评论(0) 推荐(0) 编辑
摘要:encode('utf-8').decode('unicode_escape') 阅读全文
posted @ 2019-06-15 15:51 乔儿 阅读(794) 评论(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 乔儿 阅读(1261) 评论(0) 推荐(0) 编辑
摘要:# coding=gbk 阅读全文
posted @ 2019-06-08 14:58 乔儿 阅读(886) 评论(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 乔儿 阅读(3306) 评论(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 乔儿 阅读(15065) 评论(1) 推荐(3) 编辑

点击右上角即可分享
微信分享提示