An isalpha() that accepts underscores as well

egbert egbert.bouwman at hccnet.nl
Sun Feb 26 13:58:41 EST 2006


The string method isalpha() returns True when all characters in the
string are alphabetic. Unfortunately the underscore is not alphabetic.
A function that does what I need is:

def alfa_(w):
    return "".join(w.split("_")).isalpha()

but for the kind of strings that I have this is about ten times
slower than isalpha() sec. Any suggestions ?
Thanks.
-- 
Egbert Bouwman - Keizersgracht 197 II - 1016 DS  Amsterdam - 020 6257991
========================================================================



More information about the Python-list mailing list