标签:error false error: foo play als pass except ror
code
def is_number(s): try: float(s) return True except ValueError: pass return False # 测试字符串和数字 print(is_number(‘foo‘)) # False print(is_number(‘1‘)) # True print(is_number(‘1.3‘)) # True print(is_number(‘-1.37‘)) # True print(is_number(‘1e3‘)) # True
标签:error false error: foo play als pass except ror
原文地址:https://www.cnblogs.com/sea-stream/p/12822060.html