Time functions
Grant Edwards
grante at visi.com
Wed May 2 14:08:23 EDT 2007
On 2007-05-02, Matimus <mccredie at gmail.com> wrote:
>> I think I have an import misconception.
>>
>> I use
>> import from time localtime, strftime
>> t = strftime('%m/%d/%Y %H:%M', localtime())
>>
>> This works. How would one use it with the module name pre-pended?
>
> I would think that what you have written there shouldn't work at
> all...
It doesn't.
> it would need to be:
>
> [code]
> from time import localtime, strftime
> [/code]
>
> to use the prepended module name just do this instead:
>
> [code]
> import time
> t = time.strftime('%m/%d/%Y %H:%M', time.localtime())
> [/code]
or just this
t = time.strftime('%m/%d/%Y %H:%M')
time.strftime() has used the localtime() value by default for
a while now.
--
Grant Edwards grante Yow! There's enough money
at here to buy 5000 cans of
visi.com Noodle-Roni!
More information about the Python-list
mailing list