Python環境搭建以及urllib request模組使用
阿新 • • 發佈:2018-12-27
問題引入:也是剛接觸python,然後就就在python官網上下載了python2.7版本,但是在使用urllib request模組時一直報錯,後來解決辦法是將python升級到最新版本就可以使用,python3中自帶urllib request模組。
request模組使用:
# coding=utf-8
from urllib.request import urlopen
html = urlopen('http://jr.jd.com')
print(html.read())