python 采集的另一种方式(速度更快)

2017-9-3 流沙 python

#coding:utf-8 import requests,bs4,sys #防止 编码问题 reload(sys) sys.setdefaultencoding('utf8') for i in range(1,30000):     res = requests.get('http://www.yangtuobaobei.cn/?'+str(i))     userFile = open('userNew.txt', 'a')     if(res.status_code == 200):   ...

阅读全文>>

评论(0) 浏览(269)


BeautifulSoup4 UserWarning

2017-9-3 流沙 python

错误描述: /opt/ActivePython-2.7/lib/python2.7/site-packages/bs4/__init__.py:166: UserWarning: No parser was explicitly specified, so I'm using the best available HTML parser for this system ("lxml"). This usually isn't a problem, but if you run this code on another system, or in a different virtua...

阅读全文>>

评论(0) 浏览(240)


python 简单采集测试

2017-9-3 流沙 python

#coding:utf8 import requests,re,sys #防止 编码问题 reload(sys) sys.setdefaultencoding('utf8') for i in range(1,400000): res = requests.get('http://www.yangtuobaobei.cn/?'+str(i)) if res.status_code==200: userFile = open('user.txt','a') #多行匹配,拿到用户名 user = re....

阅读全文>>

评论(0) 浏览(219)


python 文件备份

2017-9-3 流沙 python

#coding:utf8 import zipfile,os def backupToZip(folder):     folder = os.path.abspath(folder)     number = 1     while True:         zipFileName = os.path.basename(folder)+"_"+str(number)+".zip"         if not os.path.exis...

阅读全文>>

评论(0) 浏览(243)


python 目录遍历

2017-9-2 流沙 python

#coding:utf8 import os for muluName,zimuluName,fileName in os.walk("H:\\LK"):     for zimulu in zimuluName:         print "目录:"+muluName+" 中的子目录:"+zimulu     for file in fileName:         print "目录:"+muluName+" 中的文件 :"+file print...

阅读全文>>

评论(0) 浏览(201)


python 密码记事本项目

2017-8-26 流沙 python

保存密码到 password中, 输入对应的参数 ,可以直接拿到密码 #coding:utf-8 passwords = { 'email':'asdasxxasdfadasdf', 'blog':'azzxcvzcvzaaa', 'baidu':'zcvasdfadfaf', 'youku':'azcaaszxcvzcvzv' } import sys if(len(sys.argv)<2): print "参数个数不得少于2个".decode("utf-8").encode("GBK") sys....

阅读全文>>

评论(0) 浏览(195)


解决python 在 cmd下 中文乱码的问题

2017-8-26 流沙 python

1\ import sys 2\ print "参数个数不得少于2个".decode("utf-8").encode("GBK") 输出的文字上添加 .decode("utf-8").encode("GBK")

阅读全文>>

评论(0) 浏览(195)


简单测试python字典

2017-8-26 流沙 python

#coding:utf8 people={"baidu":{"apple":10,"orange":20}, "sohu":{"banner":5,"apple":13}, "youku":{"orange":3,"cup":4}, "qq":{"pies":3,"apple":90} } def getNumber(website,item): numBrought=0 for k,v in website.items(): numBrought = numBrought...

阅读全文>>

评论(0) 浏览(220)


python 学习思路

2017-5-3 流沙 python

完整的一个学习思路 先定大局, 谋而后动!

阅读全文>>

评论(0) 浏览(340)


Powered by 流沙团