LintCode:有效数字

来源:互联网 发布:网络推广人员工作要求 编辑:程序博客网 时间:2024/04/30 21:33

LintCode:有效数字

人生苦短,我用Python!

class Solution:    # @param {string} s the string that represents a number    # @return {boolean} whether the string is a valid number    def isNumber(self, s):        # Write your code here        num = None        try:            num = eval(s)        except:            pass        if num != None:            return True        return False
0 0