我正在为 csv 文件中的每一行制作一个子列表,但我得到了一个列表
wines_list = []
for row in wines:
wines_list.append(row)
print(wines_list)
这将返回:
['id', 'country', 'description', 'designation', 'points', 'price',
'province', 'taster_name', 'title', 'variety', 'winery', 'fixed acidity',
'volatile acidity', 'citric acid', 'residual sugar', 'chlorides', 'free
sulfur dioxide', 'total sulfur dioxide', 'density', 'pH', 'sulphates',
'alcohol']
但我不想将所有值附加到子列表,并将其附加到 wines_list
所以我希望 wines_list 变成这样:
[[1, 'netherlands', 'description of the wine', 'designation', 'points', 'price',
'province', 'taster_name', 'title', 'variety', 'winery', 'fixed acidity',
'volatile acidity', 'citric acid', 'residual sugar', 'chlorides', 'free
sulfur dioxide', 'total sulfur dioxide', 'density', 'pH', 'sulphates',
'alcohol'], ANOTHER SUB LIST HERE]
撒科打诨
相关分类