最赞回答 / qq_我年轻_0
我也遇到了这个问题,很好解决。你们可以看一下任何一个网站的源码 例如本网站<...code...>他会有这一句句话 <meta charset="utf-8">这就是 html 编码的约束 。所以在 html_outputer.py 的这句话<...code...>前面 添加<...code...>output_html() 方法应为:<...code...>
2017-04-12
最赞回答 / 少年阿虎
以现在百度百科的url格式为例:root_url 变成 root_url = "http://baike.baidu.com/item/Python" 然后把 html_parser.py 中url的正则表达换成模糊匹配 links = soup.find_all('a',href = re.compile(r"item"))这样就可以了以后如果网站升级,url格式改变,也是这个套路希望能帮到你
2017-04-08