Add mode argument, default 'total'
This commit is contained in:
parent
59722e19a2
commit
20a66b8f48
5
tx
5
tx
@ -8,6 +8,10 @@ parser = argparse.ArgumentParser(description="Description")
|
|||||||
|
|
||||||
# add arguments to the parser
|
# add arguments to the parser
|
||||||
parser.add_argument("-f", "--file")
|
parser.add_argument("-f", "--file")
|
||||||
|
parser.add_argument("mode",
|
||||||
|
help="display the square of a given number",
|
||||||
|
nargs='?', default="total",
|
||||||
|
choices=["total"])
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
@ -16,6 +20,7 @@ if args.file:
|
|||||||
else:
|
else:
|
||||||
time_file = open('time.txt','r')
|
time_file = open('time.txt','r')
|
||||||
|
|
||||||
|
if args.mode == "total":
|
||||||
total_time = timedelta()
|
total_time = timedelta()
|
||||||
|
|
||||||
for line in time_file:
|
for line in time_file:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user