回答編集履歴
1
test
CHANGED
@@ -3,12 +3,12 @@
|
|
3
3
|
|
4
4
|
c = '21.3521001'
|
5
5
|
d = 'hoge'
|
6
|
-
regex = r'
|
6
|
+
regex = r'\d+\.\d{2}|[^0-9]+'
|
7
7
|
pattern_re = re.compile(regex)
|
8
8
|
v1 = re.match(pattern_re, c)
|
9
|
-
if v1 is not None
|
9
|
+
if v1 is not None: v1 = v1[0]
|
10
10
|
v2 = re.match(pattern_re, d)
|
11
|
-
if v2 is not None
|
11
|
+
if v2 is not None: v2 = v2[0]
|
12
12
|
|
13
13
|
print(v1)
|
14
14
|
print(v2)
|