danb_83 at yahoo.com
Sun Jul 8 19:57:23 CEST 2007
On Jul 8, 12:10 pm, Brad <deviantbunnyl... at gmail.com> wrote:
> So I've been studying python for a few months (it is my first foray
> into computer programming) and decided to write my own little simple
> journaling program. It's all pretty basic stuff but I decided that I'd
> learn more from it if more experienced programmers could offer some
> thoughts on how I could do things better.
> #simple little journal
> from time import asctime
> myjournal.write(todaysdate + "\n\n")
> while loop!=':a':
> if loop!=':a':
> if loopz==':a':
> #end of stuff
> So I'd appreciate some good feedback or ideas.
"""simple little journal"""
EXIT_COMMAND = ':a'
HEADER = "*" * 80
Prompt the user to enter text, and write it into the journal file.
print "Enter your journal entry."
print "When done, type %r." % EXIT_COMMAND
journal_file = file(filename, 'a+')
journal_file.write(HEADER + "\n")
journal_file.write(time.asctime() + "\n\n")
line = raw_input(':')
if line == EXIT_COMMAND:
journal_file.write(line + "\n")
"""Executed when file is run as a script."""
if argv is None:
argv = sys.argv
if len(argv) == 1: # No filename specified; use the default
if __name__ == '__main__':
More information about the Python-list