def is_integer(s): try: x = int(s) return True except: return False def is_float(s): try: x = float(s) return True except: return False