65. 有效数字

65. 有效数字
个人感觉这种题目没太有意思
class Solution:
    def isNumber(self, s: str) -> bool:
        if s in ["inf", "-inf", "+inf", "Infinity", "+Infinity", "-Infinity"]:
            return False
        try:
            float(s)
        except:
            return False
        else:
            return True

 

 
posted @ 2022-07-31 15:32  是冰美式诶  阅读(13)  评论(0)    收藏  举报