回答編集履歴

1

修正

2018/09/24 06:40

投稿

LouiS0616
LouiS0616

スコア35660

test CHANGED
@@ -20,6 +20,8 @@
20
20
 
21
21
  <class 'list'> [1110]
22
22
 
23
+ >>>
24
+
23
25
  >>> for e in a:
24
26
 
25
27
  ... e = e[0]
@@ -37,3 +39,29 @@
37
39
  <class 'int'> 1110
38
40
 
39
41
  ```
42
+
43
+
44
+
45
+ リストを潰す方法もありですが、やや高等です。
46
+
47
+ ```Python
48
+
49
+ >>> from itertools import chain
50
+
51
+ >>>
52
+
53
+ >>> for e in chain.from_iterable(a):
54
+
55
+ ... print(type(e), e)
56
+
57
+ ...
58
+
59
+ <class 'int'> 1085
60
+
61
+ <class 'int'> 1096
62
+
63
+ <class 'int'> 1108
64
+
65
+ <class 'int'> 1110
66
+
67
+ ```