At 03:41 AM 10/12/2007, Kent Johnson wrote: >Aditya Lal wrote: >>finalList = [ word for word in lstA if wellformed(word) ] > >or do everything in one statement: > finalList = [ word for word in lstA if all(c in astr for c in word) ]
I'm just not comfortable with list comprehensions yet, but I see that although yours is very succinct, it's clear enough. And I'd forgotten about the all() and any() (both new with 2.5 <http://docs.python.org/lib/built-in-funcs.html>.) >Note to Dick: >You don't have to convert word to a list before iterating it: > wordWithCommas = list(word) > print "wordWithCommas is", wordWithCommas > for char in wordWithCommas: > >could be just > for char in word: Sure, strings are iterable. Dumb of me. Thanks, Dick _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor