[techtalk] python problem

Neil ''Fred'' Picciotto fred at derf.net
Tue Dec 21 05:28:32 EST 1999

i have a weird python bug which i can't figure out...

consider the following simple python script, test.py:


import time

format = '%a %b %d %H:%M:%S %Z %Y'
timetuple1 = time.localtime(time.time())
timestring = time.strftime( format , timetuple1 )
timetuple2 = time.strptime( timestring , format )

so all it's doing is getting the time as a tuple, formatting it as a
string, and then trying to parse that string back as a tuple.

when i run it, i get:

Traceback (innermost last):
  File "./test.py", line 8, in ?
    timetuple2 = time.strptime( timestring , format )
ValueError: format mismatch

am i missing something, or is this a bug in the python interpreter?


Neil "Fred" Picciotto -=- fred at derf.net
new and improved! -=- http://www.derf.net/ -=- now with actual content!

techtalk at linuxchix.org   http://www.linuxchix.org

More information about the Techtalk mailing list