功能: 将一个filelist.conf中的url取出来,用多线程并行下载,将结果重定向到/dev/null


#!/usr/bin/python
import urllib,os,threading

proxies={'http': 'http://127.0.0.1:80'}
def processLine(line):
	print "child:",line
	while True:
		fin = urllib.urlopen(line,proxies=proxies)
		while True:
			fout=open('/dev/null', 'w')
			fout.write(fin.read(1024))

fileListName = '/tmp/filelist.conf'

fileListFile = open( fileListName )
fileNames = fileListFile.readlines()
fileListFile.close()

for fileName in fileNames:
	if fileName[-1] == '\\n':
		fileName = fileName[0:-1]
		print "Father:",fileName
		processThread = threading.Thread(target=processLine, args=[fileName])
		processThread.daemon = True
		processThread.start()




10-16 07:07
查看更多