回答編集履歴
2
コード追加
answer
CHANGED
@@ -30,4 +30,5 @@
|
|
30
30
|
second.append(linelist[1].strip('"'))
|
31
31
|
|
32
32
|
print(second) # => ['456', '654', '888']
|
33
|
-
```
|
33
|
+
```
|
34
|
+
???? [サンプル](https://replit.com/@kilesa/tera-367634)
|
1
コード追加
answer
CHANGED
@@ -16,4 +16,18 @@
|
|
16
16
|
で、
|
17
17
|
> ['456', '654', '888']
|
18
18
|
|
19
|
-
と出力されると思いますよ。
|
19
|
+
と出力されると思いますよ。
|
20
|
+
|
21
|
+
**補足:**
|
22
|
+
|
23
|
+
ご質問にあるような、一行ずつ読んでいくやり方だと、こうです。
|
24
|
+
```python
|
25
|
+
second = []
|
26
|
+
|
27
|
+
with open('sample.csv') as file:
|
28
|
+
for line in file:
|
29
|
+
linelist = line.split(',')
|
30
|
+
second.append(linelist[1].strip('"'))
|
31
|
+
|
32
|
+
print(second) # => ['456', '654', '888']
|
33
|
+
```
|