shorten this: if char in "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz":
Brian Victor
homeusenet3 at brianhv.org
Tue Jun 24 14:42:05 EDT 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:
or
if char.isalpha():
--
Brian
More information about the Python-list
mailing list