I’d like to write a python program that allows the user to key an it will write the time of the keystroke to a CSV file. E.g., a “data logger” program. The context is that we need to know the precise time that a whale dives below, so I’d like a function that when the User hits “D” it logs writes the time.
I was considering writing a function such as:
from from datetime import datetime
def D(): print datetime.now
… and then have the User hit “D()”. But my problems are that such a program closes immediately upon running the script, rather than staying open to log further “D()” instructions from the User. Plus, the User has to hit D() instead of a more ergonomic “D”
Thanks
You can use
timeandcsvmodules.