[python]模拟浏览器下载网页

#!/usr/bin/python
#DownLoad.py source_url dest_file
import sys
import urllib

src_url=sys.argv[1];
dest_file=sys.argv[2];

download=urllib.FancyURLopener();
download_page=download.open(src_url);
savefile=file(dest_file,'wb+');
while True:
	arr = download_page.read();
	if len(arr)==0:
		break;
	savefile.write(arr);
savefile.flush();
savefile.close();

你可能感兴趣的:([python]模拟浏览器下载网页)