摘要: import time t = time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time())) 阅读全文
posted @ 2019-05-27 20:37 乔儿 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 可以在直接spider、pipeline和downloaderMiddlewares中关闭爬虫 在spider中时在方法里直接写 在pipeline和downloaderMiddlewares里 虽然这一行代码会停止爬虫,但是这一行代码的停止并不是立即停止 原因是因为当我们不更改爬虫的setting 阅读全文
posted @ 2019-05-24 16:54 乔儿 阅读(817) 评论(0) 推荐(0) 编辑
摘要: 在Python中"\"一般是作为转义符用的,即(\d,\t,\n),但是有时候会用到单独的"\"如果直接这么用,那么就会报错,这时候需要双反斜线,"\\",第一个反斜线转义第二个反斜线。这样用就没有错误了。 阅读全文
posted @ 2019-05-23 15:24 乔儿 阅读(1113) 评论(0) 推荐(0) 编辑
摘要: 功能:将字符串str当成有效的表达式来求值并返回计算结果。 语法: eval(source[, globals[, locals]]) -> value 参数: source:一个Python表达式或函数compile()返回的代码对象 globals:可选。必须是dictionary locals 阅读全文
posted @ 2019-05-23 14:50 乔儿 阅读(910) 评论(0) 推荐(0) 编辑
摘要: import re re.split(r"[*×]",xg) #这里是根据*或者x来分割的 阅读全文
posted @ 2019-05-21 11:56 乔儿 阅读(853) 评论(0) 推荐(0) 编辑
摘要: t = int(round(time.time() * 1000)) 阅读全文
posted @ 2019-05-17 20:07 乔儿 阅读(1426) 评论(0) 推荐(0) 编辑
摘要: data = {"mobileNo":"15201222502","cityId":"402","userClassId":1,"userDisplayClass":0,"addressId":"","deviceType":3} response = requests.post(url=url,headers=headers,data=json.dumps(data)) 阅读全文
posted @ 2019-05-17 19:57 乔儿 阅读(493) 评论(0) 推荐(0) 编辑
摘要: 1、(1241, 'Operand should contain 1 column(s)'),原因是数据类型出现错误,数据库中该字段是str类型,但是要插入的数据类型是list。 2、(1064, "You have an error in your SQL syntax; check the ma 阅读全文
posted @ 2019-05-15 19:52 乔儿 阅读(318) 评论(0) 推荐(0) 编辑
摘要: scrapy框架默认是有去重(重复的请求直接忽略掉)设置的,就是如果多个请求完全相同,那么就会报错“Filtered duplicate request no more duplicates will be shown (see DUPEFILTER_DEBUG to show all duplic 阅读全文
posted @ 2019-05-14 20:58 乔儿 阅读(2044) 评论(0) 推荐(0) 编辑
摘要: SELECT channel, count(*) from crawled_goods where datediff(created_at,NOW())=0 and channel like '%yijiupi%'GROUP BY( channel) 阅读全文
posted @ 2019-05-14 10:53 乔儿 阅读(466) 评论(0) 推荐(0) 编辑