我有一個car.csv,其中有這樣的臺詞:讀csv文件到列表中的列表,而在Python
vhigh,vhigh,2,2,small,low,unacc
我想:
[vhigh,vhigh,2,2,small,low,unacc].
但隨着這個代碼
import csv
a = []
with open("car.csv", 'r') as f:
reader = csv.reader(f)
for line in f:
a.append([line]);
我得到
['vhigh,vhigh,2,2,small,med,unacc\n'].
有人可以幫我嗎?
我並不知道[vhigh,vhigh,2,2,small,low,unacc]與['vhigh','vhigh','2','2','small' ,'low','unacc'] – kassio