Skip to content

Commit 6042353

Browse files
committed
Create 65 - Python
1 parent c963241 commit 6042353

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

solution/0065.Valid/Solution.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
class Solution:
2+
def isNumber(self, s):
3+
"""
4+
:type s: str
5+
:rtype: bool
6+
"""
7+
8+
NumberRE = "[\+\-]?((\d+\.?\d*|\d*\.?\d+)(e[\+\-]?\d+)?)"
9+
10+
s = s.strip()
11+
12+
Ans = re.match(NumberRE, s)
13+
14+
if Ans and len(s) == Ans.regs[0][1] :
15+
return True
16+
17+
return False

0 commit comments

Comments
 (0)