-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
Closed as not planned
Labels
type-featureA feature request or enhancementA feature request or enhancement
Description
Feature or enhancement
Proposal:
A string method called .isnumber(), it will check if a string is a float or an integer and return True or False.
def isnumber(text)
try:
float(text)
return True
except ValueError:
return False
Examples:
abc = "123"
pi = "3.14159"
hello = "hello"
print(isnumber(abc)) # True
print(isnumber(pi)) # True
print(isnumber(hello)) # False
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response
Metadata
Metadata
Assignees
Labels
type-featureA feature request or enhancementA feature request or enhancement