python 3.X版本 利用urllib.request 通过制定的URL抓取网易内容

来源:互联网 发布:openwrt 网络唤醒 编辑:程序博客网 时间:2024/06/05 09:27
import urllib.requestresp=urllib.request.urlopen('http://www.baidu.com')html=resp.read()print(html)

python 3.X和python2.7版本的地方是

3.X用的是urllib.request

2.7用的是urllib2

2.7版本是

import urllib2  response = urllib2.urlopen('http://www.baidu.com/')  html = response.read()  print html  


阅读全文
0 0
原创粉丝点击