1
0

use argparse

This commit is contained in:
thurask
2017-10-10 15:25:38 -04:00
parent 0d250087f9
commit 173060dff1
5 changed files with 38 additions and 24 deletions
+6 -3
View File
@@ -19,6 +19,10 @@ fc.mode = fc.MODE_FULL
#fc.cltp = 10
fc.cltp = 2010
dp = tcllib.DefaultParser(__file__)
dp.add_argument("tocheck", nargs="?", default=None)
args = dp.parse_args(sys.argv[1:])
print("Valid PRDs not already in database:")
with open("prds.txt", "r") as afile:
@@ -30,13 +34,12 @@ with open("prds.txt", "r") as afile:
for key, value in prdc.items():
prddict[key].append(value)
if len(sys.argv) > 1:
if args.tocheck is not None:
prdkeys = list(prddict.keys())
for k in prdkeys:
if k != sys.argv[1]:
if k != args.tocheck:
del prddict[k]
for center in sorted(prddict.keys()):
tails = [int(i) for i in prddict[center]]
total_count = 1000 - len(tails)