Python调用
Python如何设置方式,然后调用一个网页内容? 我喜欢用 urllib 库,python自带,代码:from urllib.request import urlopen,Request
url = "www.baidu.com"
headers = {"User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36"}
Req = Request(url,headers=headers)
html = urlopen(Req).read().decode()
print(html)
额,"调用" 是什么意思?
是要提取网页中的信息吗?
页:
[1]