凌的博客

您现在的位置是: 首页 > 学无止境 > python > 

python

python 抓取网页

2015-05-17 python 942
import urllib.request res = urllib.request.urlopen(\"http://www.yetyun.com\") content = res.read().decode(\"utf-8\") t = open(\"test.html\",\"w\",encoding=\'utf-8\') print(content,file=t) t.close()
import urllib.request
res = urllib.request.urlopen("http://www.yetyun.com")
content = res.read().decode("utf-8")
t = open("test.html","w",encoding='utf-8')
print(content,file=t)
t.close()

文章评论

0条评论