python每日进阶--爬虫

#coding=utf-8
import urllib.request

def getHtml(url): 
    page = urllib.request.urlopen(url)
    html = page.read()
    html = html.decode('utf-8')
    return html

html = getHtml("http://www.vandream.com/html/about.html")
txt = '../asset/b.html'
f = open(txt, 'w+')
f.write(html)
print("写入成功")

猜你喜欢

转载自blog.csdn.net/webofrxy/article/details/80322295