peter at engcorp.com
Wed Apr 21 21:26:16 CEST 2004
Jonas Galvez wrote:
> If I have a tuple like this:
> (year, month, day, hour, minute)
> Is there a way to automatically generate a string like this?
> I remember seeing something about it somewhere... wanted to be sure.
You want to read about the "time" module:
>>> t = (2004, 4, 21, 15, 33)
>>> import time
>>> time.strftime('%Y-%m-%dT%H:%M:00', t+(0,0,0,0))
I left the "T" in there as a literal because I don't know what you
meant it to be and there's no obvious single-character substitution.
More information about the Python-list