python爬虫笔记

1.抓取网页并保存到txt中.解决控制台乱码问题

#_*_coding:utf-8_*_
import urllib2
response = urllib2.urlopen('http://hws.m.taobao.com/cache/wdetail/5.0/?id=540698103032')
cont = response.read()
file1 = open("./1.txt","w")
file1.write(cont)
file1.close()
print cont.decode("utf-8").encode("gbk")

2.操作json

3.循环数组

https://www.cnblogs.com/Owen-ET/p/6932272.html

 

4.操作mssql

https://www.cnblogs.com/qianlifeng/archive/2012/02/06/2340367.html

https://www.cnblogs.com/lrzy/p/4346781.html

 

  

posted on 2017-11-10 21:41  隨風.NET  阅读(185)  评论(0编辑  收藏  举报

导航