#-------PYTHON获取网页内容-------------# import sys, urllib url = "http://www.163.com" #网页地址 wp = urllib.urlopen(url) #打开连接 content = wp.read() #获取页面内容 fp = open("d:\\python\\web.txt","w") #打开一个文本文件 fp.write(content) #写入数据 fp.close() #关闭文件 |
#-------PYTHON获取网页内容-------------# import sys, urllib url = "http://www.163.com" #网页地址 wp = urllib.urlopen(url) #打开连接 content = wp.read() #获取页面内容 fp = open("d:\\python\\web.txt","w") #打开一个文本文件 fp.write(content) #写入数据 fp.close() #关闭文件 |
本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。