# Interger will be flaged as True as well. def isfloat(num): try: float(num) return True except ValueError: return False print(isfloat('s12')) False print(isfloat('1.123')) True print(isfloat('456')) True