DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: WorkLog.py - work logging  (Read 6,130 times)

justice

  • Solve issues simply.
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,898
    • Participated in NANY Challenge Four Times
    • Cody Award
    • Coding Snacks
    • DJ Badge - DJ
WorkLog.py - work logging
« on: April 26, 2016, 09:15 AM »
Wrote this little script and thought it might be useful here. It allows you to keep track of what you are working on by writing a timestamped message to a CSV file.

worklog.png

Latest version: https://gist.github.com/svandragt/080843c4ba632deaab6f3aea57ca9684
Code: ( python)
#v1.0.2
from random import choice
from datetime import datetime

phases = [
    'Ok, noted.', 'Right, back to work then!', 'Looking good bud.', 'Cheers, mate.'
]

now = datetime.now()
answer = ''
with open("worklog.csv", "a") as f:
    while answer.strip() != 'exit':
        f.write('"{}","{}"\n'.format(now,answer.strip()))
        answer = input("What're you working on? ")
        now = datetime.now()
        print("[{}]".format(now),choice(phases), "\n")

Requires Python 3.5. Then just run the file.
« Last Edit: April 26, 2016, 02:22 PM by justice »

Original address: https://www.donationcoder.com/forum/index.php?topic=42573.0