这篇文章介绍了一些urllib2的使用细节:http://zhuoqiang.me/python-urllib2-usage.html
urllib和urllib2是http的客户端库。
urllib2最简单的使用:
import urllib2
response = urllib2.urlopen("http://www.baidu.com", timeout=20)
html = response.read()
response.close()
print html
这篇文章介绍了一些urllib2的使用细节:http://zhuoqiang.me/python-urllib2-usage.html
urllib和urllib2是http的客户端库。
urllib2最简单的使用:
import urllib2
response = urllib2.urlopen("http://www.baidu.com", timeout=20)
html = response.read()
response.close()
print html