Back
How can I detect either numbers or letters in a string? I am aware you use the ASCII codes, but what functions take advantage of them?
For checking whether a Python string is a number or a letter you can use the below-mentioned code:-
def isinteger(a): try: int(a) return True except ValueError: return False
def isinteger(a):
try:
int(a)
return True
except ValueError:
return False
31k questions
32.8k answers
501 comments
693 users