Newbie Q on searching lists
Patrick W
patrickw106 at yahoo.com.au
Sat Nov 23 06:02:11 EST 2002
Kenny Tilton <ktilton at nyc.rr.com> writes:
> >>1. Am I missing something?
> >>
> > if calculators.count(thisCalculator): # returns zero if not found
> > raise CircularDependency, thisCalculator
>
> oops :) thx!
Try this:
if thisCalculator in calculators:
do_stuff()
Tests of the form '<item> in <sequence>' work for dictionaries
(hashtables), strings and tuples as well as lists.
More information about the Python-list
mailing list