谢谢老师,老师讲的很棒,思路清晰明确。0基础也能轻松写出来!
老师用的2 ,有用的3++可以参考我的源码: https://github.com/MarkNiu/BaiKe_Spider 有详细注释+输出页面美化!!!
老师用的2 ,有用的3++可以参考我的源码: https://github.com/MarkNiu/BaiKe_Spider 有详细注释+输出页面美化!!!
2017-05-10
python2.7.13 urllib2 def add_data(self, data) 方法只能接收一个参数
2017-05-10
用pathon2.7写的,欢迎下载
http://download.csdn.net/detail/fishseeker/9836582
http://download.csdn.net/detail/fishseeker/9836582
2017-05-08
如果output.html输出乱码,可以在输出器中添加 fout.write('<meta charset="utf-8">')
2017-05-07
URL带中文、特殊字符的处理
百度了一番:
import urllib.request
from urllib.parse import quote
import string
url = "http://baike.baidu.com/item/史记·2016?fr=navbar";
url_ = quote(url, safe = string.printable);
response = urllib.request.urlopen(url_);
百度了一番:
import urllib.request
from urllib.parse import quote
import string
url = "http://baike.baidu.com/item/史记·2016?fr=navbar";
url_ = quote(url, safe = string.printable);
response = urllib.request.urlopen(url_);
2017-05-07
打印乱码第一行加一句:# This Python file uses the following encoding: <encoding name>
参见 https://www.python.org/dev/peps/pep-0263/
参见 https://www.python.org/dev/peps/pep-0263/
2017-05-07