Created
November 10, 2009 16:58
-
-
Save hktechn0/231034 to your computer and use it in GitHub Desktop.
isascii() on Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def isascii(c, printable = False): | |
if 0x00 <= ord(c) <= 0x7f: | |
if printable: | |
if 0x20 <= ord(c) <= 0x7e: | |
return True | |
else: | |
return False | |
else: | |
return True | |
else: | |
return False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think this would work as well: