#-------PYTHON获取网页内容-------------#

import sys, urllib

url = "http://www.163.com" #网页地址

wp = urllib.urlopen(url) #打开连接

content = wp.read() #获取页面内容

fp = open("/home/cx/content.txt","w") #打开一个文本文件

fp.write(content) #写入数据

fp.close() #关闭文件
 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-23
猜你喜欢
  • 2021-12-26
  • 2021-07-07
  • 2021-12-26
  • 2022-01-07
  • 2021-09-21
  • 2021-09-26
  • 2021-11-02
相关资源
相似解决方案