[Tutor] elif

Øyvind python at kapitalisten.no
Tue Jun 6 12:26:07 CEST 2006


Hello.

I need to make a program that does certain things every 5 minutes
mon-friday. I have started writing it like this:

        if strftime('%w') == 1:
            if strftime('%M') % 5 == 0:
                n.start()

        elif strftime('%w') == 2:
            if strftime('%M') % 5 == 0:
                n.start()

        ........

This seems kind of a redundant way of writing the code.

I haven't gotten any statement like this to work:
if strftime('%w') == 1 or 2 or 3:
or
for strftime('%w') in range(1,5):

What would be a more efficient way of writing it without writing it
several times?

Thanks in advance,
Øyvind


-- 
This email has been scanned for viruses & spam by Decna as - www.decna.no
Denne e-posten er sjekket for virus & spam av Decna as - www.decna.no



More information about the Tutor mailing list