deal with empty lines in input file (fix #15)
This commit is contained in:
parent
d0db0c62aa
commit
c7a602ae4e
@ -34,9 +34,9 @@ import sys
|
|||||||
import time
|
import time
|
||||||
from statistics import stdev
|
from statistics import stdev
|
||||||
|
|
||||||
|
import dns.flags
|
||||||
import dns.rdatatype
|
import dns.rdatatype
|
||||||
import dns.resolver
|
import dns.resolver
|
||||||
import dns.flags
|
|
||||||
|
|
||||||
__VERSION__ = 1.0
|
__VERSION__ = 1.0
|
||||||
__PROGNAME__ = os.path.basename(sys.argv[0])
|
__PROGNAME__ = os.path.basename(sys.argv[0])
|
||||||
@ -179,6 +179,9 @@ def main():
|
|||||||
print((70 + width) * '-')
|
print((70 + width) * '-')
|
||||||
for server in f:
|
for server in f:
|
||||||
# check if we have a valid dns server address
|
# check if we have a valid dns server address
|
||||||
|
if server.lstrip() == '': # deal with empty lines
|
||||||
|
continue
|
||||||
|
|
||||||
try:
|
try:
|
||||||
ipaddress.ip_address(server)
|
ipaddress.ip_address(server)
|
||||||
except ValueError: # so it is not a valid IPv4 or IPv6 address, so try to resolve host name
|
except ValueError: # so it is not a valid IPv4 or IPv6 address, so try to resolve host name
|
||||||
|
Loading…
x
Reference in New Issue
Block a user