回答編集履歴
3
助詞抜け
answer
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
[int(re.match(r'(^|.* )a=(\d*)($| .*)',item).group(2)) for item in ['a=1 b=2 c=3', 'a=2 b=3, c=4']]
|
8
8
|
```
|
9
9
|
|
10
|
-
利用している技術以下のとおりです。
|
10
|
+
利用している技術は以下のとおりです。
|
11
11
|
- [正規表現](https://docs.python.org/ja/3/library/re.html)で文字列から対象部分の切り出し
|
12
12
|
- [int 関数](https://docs.python.org/ja/3/library/functions.html?highlight=int#int)で文字列から数値に変換
|
13
13
|
- [リスト内包表記](https://docs.python.org/ja/3/tutorial/datastructures.html#list-comprehensions)で個々の要素に関数を適用した結果のリストの生成
|
2
ミスの修正
answer
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
```python
|
6
6
|
import re
|
7
|
-
[int(re.match(r'(^|.* )a=(\d*)($| .*)',item).group(
|
7
|
+
[int(re.match(r'(^|.* )a=(\d*)($| .*)',item).group(2)) for item in ['a=1 b=2 c=3', 'a=2 b=3, c=4']]
|
8
8
|
```
|
9
9
|
|
10
10
|
利用している技術以下のとおりです。
|
1
せめて a= の場所が先頭でなくても良いようにし xa=4 とかに騙されないように修正した
answer
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
```python
|
6
6
|
import re
|
7
|
-
[int(re.match(r'a=(\d*) .*',item).group(1)) for item in ['a=1 b=2 c=3', 'a=2 b=3, c=4']]
|
7
|
+
[int(re.match(r'(^|.* )a=(\d*)($| .*)',item).group(1)) for item in ['a=1 b=2 c=3', 'a=2 b=3, c=4']]
|
8
8
|
```
|
9
9
|
|
10
10
|
利用している技術以下のとおりです。
|