阅读背景:

python3爬虫.1.简单的网页爬虫

来源:互联网 

此为记录下我自己的爬虫学习过程。

利用url包抓取网页

import urllib.request                   #url包

def main():
    url = "https://www.douban.com/"
    response = urllib.request.urlopen(url)      #请求
    html = response.read()                      #获取
    html = html.decode("utf-8")                 #解码
    print(html)                                 #打印

if __name__ == "__main__":
    main()
import urll



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: