Timothy Sikes wrote:
> Sorry, but in my previous message, I realized that I hadn't changed the
> code from doesNotHave... It's supposed to be x.find(), not
> x.startswith..
You meant to write:
def doesNotHave(exclude, root):
for x in exclude:
if root.find(x) > -1:
return False
return True
This can be written as
def doesNotHave(exclude, root):
for x in exclude:
if x in root:
return False
return True
or
def doesNotHave(exclude, root):
return not any(x in root for x in exclude)
Kent
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor