摘要: def extract_cookies(cookie): """从浏览器或者request headers中拿到cookie字符串,提取为字典格式的cookies""" cookies = dict([l.split("=", 1) for l in cookie.split("; ")]) ret 阅读全文
posted @ 2019-05-10 20:42 乔儿 阅读(721) 评论(0) 推荐(0) 编辑
摘要: 1、查询某天的数据量: SELECT count(*) from crawled_goods where channel='yijiupi-beijing' and datediff(created_at,NOW()) = -1(0代表今天,-1代表昨天); 2、查询某个时间段的数据量:SELECT 阅读全文
posted @ 2019-05-10 13:34 乔儿 阅读(102) 评论(0) 推荐(0) 编辑
摘要: 一个字典通过format()函数转换后就会由dict变为str, 例如: 所以在用的时候需要再将str转为dict,这里用到的转换为eval(), 例如: 附上原链接:https://blog.csdn.net/weixin_40894428/article/details/80683137 阅读全文
posted @ 2019-05-10 10:56 乔儿 阅读(2623) 评论(0) 推荐(0) 编辑
摘要: 猜测你的代码是这样的: return Request('http://www.baidu.com', meta={'cookiejar': 1}, callback=self.next1) 有两种解决方法: 1.使用yield, 把return换为yield yield scrapy.Request(self.start_urls, callback=self.parse_link) ... 阅读全文
posted @ 2019-05-10 10:21 乔儿 阅读(449) 评论(0) 推荐(0) 编辑
摘要: 例如: 运行这个函数会报错:TypeError: not enough arguments for format string,原因是'Submit': '%sjdf'里面的%在后面的括号中没有定义,所以就会报错not enough argument(没有足够的参数),所以在遇到这种字符串中携带%的 阅读全文
posted @ 2019-05-10 10:08 乔儿 阅读(4428) 评论(0) 推荐(0) 编辑