[Tutor] How to determine if every character in one string is in another string?

Jerry Hill malaclypse2 at gmail.com
Sat Jul 21 06:05:13 CEST 2007


On 7/20/07, Terry Carroll <carroll at tjc.com> wrote:
> Is there a straightforward way to find out if all characters in one string
> are present in a second string?

I like this one:
all(char in string.printable for char in testString)

>>> testString = "qwerty\buiop"
>>> all(char in string.printable for char in testString)
False

-- 
Jerry


More information about the Tutor mailing list