import optparse, os, socket, time
def parse_args():
usage = """
python test.py test
"""
parser = optparse.OptionParser(usage)
help = "Iplist File"
parser.add_option("-f","--file", dest=‘iplistfile‘,default=‘iplist.txt‘,help=help)
help = "Cmd File"
parser.add_option("-c","--config", dest=‘cmdfile‘,default=‘config‘,help=help,metavar="FILE")
help = "Log File"
parser.add_option("-o","--output", dest=‘logfile‘,default=‘7z.log‘,help=help)
help = "Process Num"
parser.add_option("-p","--process", type=int,default=20,help=help)
help = "The interface to listen on. Default is localhost."
parser.add_option(‘--iface‘, help=help, default=‘localhost‘)
help = "The number of seconds between sending bytes."
parser.add_option(‘--delay‘, type=‘float‘, help=help, default=.1)
help = "The port to listen on. Default to a random available port."
parser.add_option(‘--port‘, type=‘int‘, default=5000,help=help)
help = "The number of bytes to send at a time."
parser.add_option(‘--num-bytes‘, type=‘int‘, help=help, default=10)
options, args = parser.parse_args()
if len(args) != 1:
parser.error(‘Provide exactly one poetry file.‘)
poetry_file = args[0]
if not os.path.exists(args[0]):
parser.error(‘No such file: %s‘ % poetry_file)
return options, poetry_file
本文出自 “我是一只小小鸟” 博客,请务必保留此出处http://2242558.blog.51cto.com/2232558/1545307
原文地址:http://2242558.blog.51cto.com/2232558/1545307