Most efficient way to evaluate the contents of a variable.

Stargaming stargaming at gmail.com
Fri Jul 13 00:37:19 EDT 2007


bdude schrieb:
> Hey, I'm new to python and am looking for the most efficient way to
> see if the contents of a variable is equal to one of many options.
> 
> Cheers,
> Bryce R
> 

if var in ('-h', '--hello', '-w', '--world'):
     pass

Most maintenance-efficient, that is.



More information about the Python-list mailing list