使用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)