回答編集履歴

1

2024/11/19 16:34

投稿

melian
melian

スコア20574

test CHANGED
@@ -2,15 +2,8 @@
2
2
  ```python
3
3
  import re
4
4
 
5
- lst = ['1DF', '2', '10F0','300AAA','1100A0']
5
+ lst = ['1DF', '2', '10F0', '300AAA', '1100A0']
6
- no = []
7
- syohin = []
8
-
9
- for s in lst:
10
- m = re.split(r'^(\d+)', s)[1:]
6
+ no, syohin = map(list, zip(*[re.split(r'^(\d+)', s)[1:] for s in lst]))
11
- no.append(m[0])
12
- syohin.append(m[1])
13
-
14
7
  print(no)
15
8
  print(syohin)
16
9