Skip to main content
 首页 » 编程设计

python之如何使用 python 获取 html

2025年05月04日11shangdawei

<分区>

我想获取特定网站上的 html 文档。

此代码运行良好。

import urllib2 
 
link = "https://www.google.com" 
print link 
f = urllib2.urlopen(link) 
myfile = f.read() 
print myfile 

但是这段代码不起作用。

import urllib2 
 
link = "https://www.virustotal.com/en/file/7cf757e0943b0a6598795156c156cb90feb7d87d4a22c01044499c4e1619ac57/analysis/" 
print link 
f = urllib2.urlopen(link) 
myfile = f.read() 
print myfile 

为什么不在特定网站上工作?