[Tutor] elif

Sean Fioritto sean.fioritto at gmail.com
Tue Jun 6 21:04:14 CEST 2006


Øyvind,

I know this isn't Python advice, but in general it seems as if setting
up a cron job would be easier. If you don't know how, I could gladly
help.

- Sean

On 6/6/06, Øyvind <python at kapitalisten.no> wrote:
> 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
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>


More information about the Tutor mailing list