01 2018 档案
摘要:经过各种排查,最后找到原因,在settings文件中配置文件大小写写错了,在pipelines中
阅读全文
摘要:查阅相关资料,了解到使用ImagesPipeline传入的url地址必须是一个list,而我写的是一个字符串,所以报错,所以需要修改一下传入的url格式就行了
阅读全文
摘要:# coding=utf-8 import sys class Hello(): def hello(self): print('the name of method is ## {} ##'.format(sys._getframe().f_code.co_name)) print('the name of class is ## {} ##'.fo...
阅读全文
摘要:# coding=utf-8 from urllib.parse import urlencode import requests from requests.exceptions import RequestException,Timeout import json from bs4 import BeautifulSoup from pymongo import MongoClient fr...
阅读全文
摘要:对一个列表,比如[1,2,2,2,2,3,3,3,4,4,4,4],现在我们需要统计这个列表里的重复项,并且重复了几次也要统计出来 方法1: ? 1 2 3 4 mylist = [1,2,2,2,2,3,3,3,4,4,4,4] myset = set(mylist) #myset是另外一个列表,
阅读全文
摘要:lxml,是python中用来处理xml和html的功能最丰富和易用的库
阅读全文
摘要:转载:http://blog.csdn.net/xhw88398569/article/details/48690163 __xxxitem__:使用 [''] 的方式操作属性时被调用 __setitem__:每当属性被赋值的时候都会调用该方法,因此不能再该方法内赋值 self.name = val
阅读全文
摘要:>>> import lxml.html >>> broken_html='AreaPopulation' >>> tree=lxml.html.fromstring(broken_html) #parse the HTML >>> fixed_html=lxml.html.tostring(tree,pretty_print=True) >>> print fixed_html Area P...
阅读全文