Skip to content

Instantly share code, notes, and snippets.

@seece
Created May 10, 2016 20:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seece/a81ed09f79dd7814919a2d7a69d8d095 to your computer and use it in GitHub Desktop.
Save seece/a81ed09f79dd7814919a2d7a69d8d095 to your computer and use it in GitHub Desktop.
A "timetracker" "application"
import readline
import datetime
logpath = "times.txt"
lines = []
try:
with open(logpath, "r") as f:
lines = f.readlines()
except:
print "%s doesn't exist yet, no problem." % logpath
for l in lines[-3:]:
p = l.split(";")
print "%s\t%s" % (p[0], p[1].strip())
line = raw_input("> ")
print line
date = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
with open(logpath, "a") as f:
msg = "%s; %s\n" % (date, line)
f.write(msg)
print msg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment