📅  最后修改于: 2022-03-11 14:47:23.703000             🧑  作者: Mango
def is_number(n):
is_number = True
try:
# v type-casting the number here as `complex`, instead of `float`
num = complex(n)
is_number = num == num
except ValueError:
is_number = False
return is_number