defprogproc(progressbar, count, progress): """ Since ProgressBar is not a thread-safe class, we use a Queue to do the counting job, like two other threads. Use this thread do the printing of progress bar. By the way, it will print to stderr, which does not conflict with the default result output(stdout). """ idx = 1 whileTrue: try: progress.get(timeout=5) except Queue.Empty: pass else: progressbar.update(idx) idx += 1
用法很简单:
1 2 3 4 5 6 7 8 9 10 11 12
usage: main.py [-h][-o OUTPUT] iprange
positional arguments: iprange The string of IP range, such as: "192.168.1.0-192.168.1.255" : beginning-end "192.168.1.0/24" : CIDR "192.168.1.*" : wildcard
optional arguments: -h, --help show this help message and exit -o OUTPUT, --output OUTPUT The output destination of result, default is stdout