If you just want integers and reject decimal numbers. You, you can use the following function to check.
def isInteger(string): if string[0] == '-': #if a negative number return string[1:].isdigit() else: return string.isdigit() def isInteger(string): if string[0] == '-': #if a negative number return string[1:].isdigit() else: return string.isdigit()