[Tutor] 2 problems in a small script

Kent Johnson kent37 at tds.net
Fri Oct 12 12:41:53 CEST 2007


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) ]

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:

Kent


More information about the Tutor mailing list