Compare commits
No commits in common. "20a66b8f48b933e2d1da3cd8032e587dddadc323" and "79b1364eb34d79b0eafbf6ba91464a940e3ebba8" have entirely different histories.
20a66b8f48
...
79b1364eb3
4
time.txt
4
time.txt
@ -1,4 +0,0 @@
|
|||||||
2020-08-12 01:00 Work on Task 1
|
|
||||||
2020-08-12 03:00 Work on Task 2
|
|
||||||
2020-08-16 05:00 Finish Task 2
|
|
||||||
2020-08-31 -08:00 Fee note for August
|
|
34
tx
34
tx
@ -1,34 +0,0 @@
|
|||||||
#!/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")
|
|
||||||
parser.add_argument("mode",
|
|
||||||
help="display the square of a given number",
|
|
||||||
nargs='?', default="total",
|
|
||||||
choices=["total"])
|
|
||||||
|
|
||||||
args = parser.parse_args()
|
|
||||||
|
|
||||||
if args.file:
|
|
||||||
time_file = open(args.file,'r')
|
|
||||||
else:
|
|
||||||
time_file = open('time.txt','r')
|
|
||||||
|
|
||||||
if args.mode == "total":
|
|
||||||
total_time = timedelta()
|
|
||||||
|
|
||||||
for line in time_file:
|
|
||||||
date_time_description = line.split(" ", 2)
|
|
||||||
|
|
||||||
hours, minutes = date_time_description[1].split(':', 1)
|
|
||||||
delta = timedelta(hours=int(hours), minutes=int(minutes))
|
|
||||||
|
|
||||||
total_time += delta
|
|
||||||
|
|
||||||
print('Total time: ', total_time)
|
|
Loading…
x
Reference in New Issue
Block a user