Detec nonascii in a string

Diez B. Roggisch deets at nospam.web.de
Thu Feb 23 10:54:07 EST 2006


Sebastian Bassi wrote:

> Hello,
> 
> How do I detect non-ascii letters in a string?
> I want to detect the condition that a string have a letter that is not
> here: string.ascii_letters

"äöü".decode("ascii")

should do the trick -- you get an UnicodeError when there is anything ascii
can't encode.

Diez



More information about the Python-list mailing list