Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to know if a input is a interger in python

inp = input('somrthing: ')

if inp.isnumeric():
    print('THat was a integer.')
else:
    print('That was not a integer.')
Comment

how to know if a input is a interger in python

whatever = input("Pick an integer > ")
    try:
        whatever_as_an_integer = int(whatever)
        print("That was an integer.")

    except ValueError:
        print("That is not an integer.")
Comment

how to check if a input is an integer python

whatever = input("Pick an integer > ")
try:
	whatever_as_an_integer = int(whatever)
   	print("That was an integer.")

except ValueError:
    print("That is not an integer.")
Comment

PREVIOUS NEXT
Code Example
Python :: python replace newline 
Python :: simple gui for pygame 
Python :: python read text file 
Python :: serializers.py include all fields 
Python :: cv2 waitkey 
Python :: rearrange list 
Python :: scrape with beautiful soup 
Python :: python tipi array 
Python :: subprocess the system cannot find the file specified 
Python :: python check if variable is string 
Python :: # list all keywords in Python 
Python :: shuffle rows dataframe 
Python :: delay time python 
Python :: row names pandas 
Python :: python exit program 
Python :: pandas read ods 
Python :: matplotlib title cilpped off 
Python :: add field placeholder layout crispy modelform 
Python :: python imread multiple images 
Python :: how to launch jupyter notebook from cmd 
Python :: print nested list in new lines 
Python :: list to string python 
Python :: how do you count most frequent item in a list in python 
Python :: how to color print in python 
Python :: standard module 
Python :: Removing all non-numeric characters from string in Python 
Python :: python sum attribute in list 
Python :: python get all methods of object 
Python :: how to access all the elements of a matrix in python using for loop 
Python :: how to drop a column by name in pandas 
ADD CONTENT
Topic
Content
Source link
Name
7+3 =