# -*- coding:utf-8 -*-
class Solution:
# s字符串
def isNumeric(self, s):
# write code here
if not s:
return False
i=0
if s[i] in ['+','-']:
i+=1
while (i<len(s) and self.isNUM(s[i])):
i+=1
if i<len(s) and s[i]=='.':
i+=1
if i<len(s) and self.isNUM(s[i]):
while i<len(s) and self.isNUM(s[i]):
i+=1
else:
return False
if i<len(s) and (s[i]=='e' or s[i]=='E'):
i+=1
if i<len(s) and s[i] in ['+','-']:
i+=1
if i<len(s) and self.isNUM(s[i]):
while i<len(s) and self.isNUM(s[i]):
i+=1
else:
return False
if i==len(s):
return True
else:
return False
def isNUM(self,s):
if s>='0' and s<='9':
return True
return False