"Tino Dai" <[EMAIL PROTECTED]> wrote
> dbs= ['oracle','mysql','postgres','infomix','access']
>
> and we wanted to do this:
>
> if 'oracle' in dbs or 'mysql' in dbs or 'bdb' in dbs:
> <... do something ...>
>
> Is there a short way or writing this? Something like
> ('oracle','mysql','bdb') in dbs
You could use sets and check the intersection:
dbs = set(['oracle','mysql','postgres','infomix','access'])
test = set(['oracle','mysql','dbd'])
if dbs.intersection(test):
HTH,
--
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor