Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (47.6k points)

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?

1 Answer

0 votes
by (106k points)

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

Related questions

0 votes
1 answer
0 votes
1 answer

Browse Categories

...