'16'.isdigit() >>>True '3.14'.isdigit() >>>False 'Some text'.isdigit() >>>False
def RepresentsInt(s): try: int(s) return True except ValueError: return False