[newbie] file object not returned by function?

Richard rshaw2 at midsouth.rr.com
Mon Nov 3 10:26:34 EST 2003


> >while True:
> >   minutes, seconds =  localtime()[4], localtime()[5]
> >
> >   if date != localtime()[2]:   # a new day has dawned, open a new logfile
> >      logfile = make_logfile()
> >      date = localtime()[2]
> >


Just an idea here, but you call "localtime" four times here when you
only need to call it once. Might something like this work?

<code>
while True:
    day, hours, minutes, second = localtime()[2:6]

    if date != day:
        logfile = make_logfile()
        date = day
</code>

Richard




More information about the Python-list mailing list