Add option to pass a different file
time.txt in the current directory is the default, but another path can be passed too.
This commit is contained in:
parent
abf61299a0
commit
59722e19a2
15
tx
15
tx
@ -1,8 +1,21 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from datetime import datetime, timedelta
|
||||
import argparse
|
||||
|
||||
# Parse command line arguments
|
||||
parser = argparse.ArgumentParser(description="Description")
|
||||
|
||||
# add arguments to the parser
|
||||
parser.add_argument("-f", "--file")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.file:
|
||||
time_file = open(args.file,'r')
|
||||
else:
|
||||
time_file = open('time.txt','r')
|
||||
|
||||
time_file = open('time.txt','r')
|
||||
total_time = timedelta()
|
||||
|
||||
for line in time_file:
|
||||
|
Loading…
x
Reference in New Issue
Block a user