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
阅读全文
摘要:这里的csv文件如果在Python解释器中打开的话是乱码的,把文件复制出来用excel打开就正常了。
阅读全文
摘要: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...
阅读全文
摘要:在中间件里面写,然后在设置里面的爬虫中间件(SPIDER_MIDDLEWARES)里面打开
阅读全文
摘要: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)...
阅读全文
摘要:encode('utf-8').decode('unicode_escape')
阅读全文
摘要: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)
阅读全文
摘要:# coding=gbk
阅读全文
摘要:import requestsurl = "https://aip.baidubce.com/oauth/2.0/token"data = { 'grant_type':'client_credentials', 'client_id':API Key, 'client_secret':Secret
阅读全文
摘要:该问题的原因是:因为网址使用了https,所以经过代理时会报错。报错原因是:Python3之关闭SSL证书验证 解决办法是:关闭验证SSL证书开关,verify:Ture/False,默认是Ture,用于验证SSL证书开关。例如:requests.get(url=url,headers=header
阅读全文