定义一个方法get_page(url),url参数是需要获取网页内容的网址,返回网页的内容。提示(可以了解python的urllib模块)。
import urllib.request
def get_page(url):
try:
response = urllib.request.urlopen(url)
html = response.read()
print(html)
except Exception as e:
return 'Url Error'