class Solution: # s字符串 def isNumeric(self, s): # write code here pointmark = False exponentmark = False signmark = False for i in range(len(s)): if s[i] == '.' and not pointmark: pointmark = True elif s[i] == 'e' or s[i] == 'E' : if not exponentmark and i < (len(s) - 1): exponentmark = True pointmark = True signmark = False else: return False elif s[i] == '+' or s[i] == '-' : if not signmark: signmark = True else: return False elif s[i] < '0' or s[i] > '9': return False elif '0' < s[i] < '9': signmark = True return True