回答編集履歴
1
修正
test
CHANGED
@@ -3,3 +3,29 @@
|
|
3
3
|
|
4
4
|
|
5
5
|
https://docs.python.jp/3/library/csv.html#csv.DictReader
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
forとindexしかどうしても使いたくないなら、手動でパースしていけば次のようにできると思いますよ。
|
12
|
+
|
13
|
+
```python
|
14
|
+
|
15
|
+
col_1 = columns.index(“name1”)
|
16
|
+
|
17
|
+
col_2 = columns.index(“name2”)
|
18
|
+
|
19
|
+
col_3 = columns.index(“name3”)
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
items = []
|
24
|
+
|
25
|
+
for line in lines:
|
26
|
+
|
27
|
+
item = lines.split(“,”)
|
28
|
+
|
29
|
+
items.append([item[col_1], item[col_2], item[col_3]])
|
30
|
+
|
31
|
+
```
|