python下载页面

使用Python下载指定页面并自动将文件命名为该URL
 
import httplib import os,sys def geturlcontent(url):  conn=httplib.HTTPConnection(url)  conn.request("GET","/")  r=conn.getresponse()  #i=r.getheader('server')  content=r.read()  path="c:/"+url+".html"  f=file(path,"wb")  f.write(content)  f.close()  conn.close() # print content url=sys.argv[1]   geturlcontent(url)
相关文章
相关标签/搜索