[Tutor] how to use the time module?

Dick Moores rdm at rcblue.com
Fri Nov 5 08:46:07 CET 2004


At 22:38 11/4/2004, Lin Jin wrote:
>i am new to python.i want to know that,if i have a variable a,and i want 
>to use the time module,the strftime method to output the weekday,how 
>could i do that? i know that i should use the the "%A",but if i write a 
>code like this:
>>>>time.strftime("%A",a).
>it is not working.anyone can help me solve this one?

This should do it (with Python 2.1 or later):

 >>> from time import strftime
 >>> a = strftime("%A")
 >>> a
'Thursday'

Dick Moores



More information about the Tutor mailing list