现在使用的python3,那个urlib2更改为urllib.request了。第三种方法的cooki也变了。
2015-12-19
Couldn't find a tree builder with the features you requested: html_parser 求解
2015-12-19
最新回答 / Roc_J
import urllib.request'''Created on 2016年2月23日@author: Roc-J'''url = "http://www.baidu.com"print('第一种方法')response =urllib.request.urlopen(url)print(response.getcode())
2015-12-19
已采纳回答 / 蚂蚁帅帅
浏览器的默认编码是GBK;两种方法:方法1、在<html>和<body>之间,加上<head><meta charset="utf-8"></head>方法2:、打开网页后,如果是chrome浏览器,点菜单》更多工具》编码,选择UTF8,其他浏览器类似。
2015-12-19
最新回答 / love181920
链接:http://pan.baidu.com/s/1o7megDO 密码:2dx7这是我写的代码,本地运行通过,效果如下:<...图片...>
2015-12-19