1. 程式人生 > >python爬蟲筆記

python爬蟲筆記

控制 解決 數組 arc code 循環數組 close brush 技術分享

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

  

python爬蟲筆記