How can I input int
or string
from the user in Python.
user = input("Enter a number or name of person")
How can I input int
or string
from the user in Python.
user = input("Enter a number or name of person")
user = input("Enter a number or name of person: ")
You want to check if it's an int
?
user = input("Enter a number or name of person: ")
try:
int(user)
except ValueError:
# The type isn't int