我试图通过使用urllib.request.open文件. 你知道吗
我不知道为什么我的代码没有停止。你知道吗
from urllib.request import urlopen
url = "https://google.com"
try:
page = urlopen(url)
f = open("google.html","wb")
f.write(page.read())
except:
print("Error")
但超时后,它收到了源代码。你知道吗
from urllib.request import urlopen
url = "https://google.com"
try:
page = urlopen(url, timeout=0.1)
f = open("google.html","wb")
f.write(page.read())
except:
print("Error")
目前没有回答
相关问题 更多 >
编程相关推荐