用python语言编程,将下列二维列表写入paiming.csv 文件 [["总分","平均分","排名"],\ ["550","55","6"],\ ["660","66","5"],\ ["770","77","4"],\ ["880","88","3"],\ ["990","99","2"],\ ["995","99.5","1"]]
时间: 2023-06-07 08:08:11 浏览: 85
利用python 读写csv文件
5星 · 资源好评率100%
好的,可以为您完成这个任务。以下是Python代码:
```python
import csv
data = [["总分", "平均分", "排名"],
["550", "55", "6"],
["660", "66", "5"],
["770", "77", "4"],
["880", "88", "3"],
["990", "99", "2"],
["995", "99.5", "1"]]
with open('paiming.csv', 'w', encoding='utf-8', newline='') as csvfile:
writer = csv.writer(csvfile)
for row in data:
writer.writerow(row)
```
执行后,将在同级目录下生成名为 "paiming.csv" 的CSV文件。
阅读全文