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

Terry Carroll carroll at tjc.com
Mon Jul 23 20:37:59 CEST 2007


On Sun, 22 Jul 2007, Jerry Hill wrote:

> On 7/21/07, Alan Gauld <alan.gauld at btinternet.com> wrote:
> > > all(char in string.printable for char in testString)
> >
> > What is all?
> > Is that a 2.5 thing (I'm still on 2.4 here)
> 
> Yes, it's a 2.5 thing.

That was my favorite, too.  I didn't notice the new all method in 2.5.  It 
certainly seems the most Pythonic approach.

I really enjoyed seeing all the proposed alternatives, however.  Thanks, 
everybody!




More information about the Tutor mailing list