[Tutor] Testing Membership in a Sequence

Christian Wyglendowski Christian.Wyglendowski at greenville.edu
Tue Mar 16 09:18:32 EST 2004


> -----Original Message-----
> On Monday 15 Mar 2004 22:42 pm, Christian Wyglendowski wrote:
> 
> > x = ['a', 'b', 'c']
> >
> > <pseudo code>
> > is ('v' or 'b') in x
> > </pseudo code>
> 
> The simplest way is this:
> 
> if 'v' in x or 'b' in x:
>   do_something()

This looks like the closest to what I envisioned as the solution.
Thanks for kickstarting my brain.

What I am actually trying to do is look for command line options in
sys.argv.

if '-o' in sys.argv or '--option' in sys.argv:
    apply_option()

Thanks to everyone for the advice.

Christian
http://www.dowski.com



More information about the Tutor mailing list