Johannes Bauer <[EMAIL PROTECTED]> wrote:
> import time
> localtime = time.localtime(1234567890)
> fmttime = "%04d-%02d-%02d %02d:%02d:%02d" % (localtime[0], localtime[1],
> localtime[2], localtime[3], localtime[4], localtime[5])
> print fmttime
>
> fmttime = "%04d-%02d-%02d %02d:%02d:%02d" % ([l
Johannes Bauer wrote:
Hello group,
I'm currently doing something like this:
import time
localtime = time.localtime(1234567890)
fmttime = "%04d-%02d-%02d %02d:%02d:%02d" % (localtime[0], localtime[1],
localtime[2], localtime[3], localtime[4], localtime[5])
print fmttime
For the third line the
Hans Nowak schrieb:
In this case, you can just use a slice, as localtime is a tuple:
fmttime = "%04d-%02d-%02d %02d:%02d:%02d" % localtime[:6]
Hope this helps! ^_^
Ahh, how cool! That's *exactly* what I meant with "awesome Python magic" :-)
Amazing language, I have to admit.
Regards,
J
Johannes Bauer wrote:
Hello group,
I'm currently doing something like this:
import time
localtime = time.localtime(1234567890)
fmttime = "%04d-%02d-%02d %02d:%02d:%02d" % (localtime[0], localtime[1],
localtime[2], localtime[3], localtime[4], localtime[5])
print fmttime
For the third line the
Hello group,
I'm currently doing something like this:
import time
localtime = time.localtime(1234567890)
fmttime = "%04d-%02d-%02d %02d:%02d:%02d" % (localtime[0], localtime[1],
localtime[2], localtime[3], localtime[4], localtime[5])
print fmttime
For the third line there is, I suppose, some