shorten this: if char in "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz":

Brian Victor homeusenet3 at
Tue Jun 24 20:42:05 CEST 2008

cirfu wrote:
> if char in "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz":
> cant i write something like:
> if char in "[A-Za-z]":

Either of the following should do what you want, without resorting to
regular expressions:

import string
if char in string.letters:


if char.isalpha():


More information about the Python-list mailing list