time.strftime('%m-%d-%Y %H:%m:%S') to log is out of order
Piet van Oostrum
piet at cs.uu.nl
Tue Jul 21 18:11:38 EDT 2009
>>>>> davidj411 <davidj411 at gmail.com> (d) wrote:
>>>
>>> > <--code below -->>
>>> > print time.strftime('%m-%d-%Y %H:%m:%S')
>>> > <--code above -->>
>d> here is the function:
>d> def log_out(msg,servername='std.out'):
>d> print msg
>d> open(log_dir + '\\' + servername + ".log",'a').write(servername + "-"
>d> + time.strftime('%m-%d-%Y %H:%M:%S') + " " + msg+'\n')
>d> on each pass, it should output the newer time (whether recursive or
>d> not, right) ?
How come your strftime is now different from the first posting? Are you
cheating?
If you want to ask a question about why your code is not working
properly there are a few important rules:
1. Copy and paste your code, and at least all relevant stuff (preferably
a minimal example that shows the problem). *DO NOT RETYPE THE CODE*
2. Copy and paste the output. *DO NOT RETYPE THE OUTPUT*
3. Tell what the expected or desired output is.
--
Piet van Oostrum <piet at cs.uu.nl>
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: piet at vanoostrum.org
More information about the Python-list
mailing list