Array of Chars to String

"Martin v. Löwis" martin at v.loewis.de
Thu Apr 21 01:34:09 EDT 2005


James Stroud wrote:
> astr = "Bob Carol Ted Alice"
> letters = "adB"

Apparently nobody has proposed this yet:

>>> filter(letters.__contains__, astr)
'Bad'
>>> filter(set(letters).__contains__, astr)
'Bad'

Regards,
Martin



More information about the Python-list mailing list