checking for ASCII character

Greg Krohn greg.invalid at capra.us.invalid
Thu Nov 13 15:15:39 EST 2003


Daniel wrote:
> Hi, is there a way to check if a letter entered is an uppercase ASCII
> character?
> 
> Thanks
> 
> Daniel

If you just want to know if a character is uppercase:

if character.isupper():
     <some code>

If it needs to be ASCII, the simplest way is probably:

if ord(character) in range(65, 91):
     <some code>



greg





More information about the Python-list mailing list