Python as a CMD data logger for time (run continously)
<p>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.</p>

<p>I was considering writing a function such as:</p>

<pre><code>   from from datetime import datetime
   def D(): print datetime.now
</code></pre>

<p>... 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"</p>

<p>Thanks</p>
