python读取网站源码

Time:2019/4/2  keywords:python读取网站源码
# -*- coding: utf-8 -*
import urllib2
content = urllib2.urlopen('http://www.163.com').read()#读取网站页面代码
#print(content)
f=open(r'd:\1.htm','w')#写入指定路径文件
f.write(content)
f.close()