目录
一、使用 csv 库
(1)导入 csv 库
首先导入 csv 库,以便读写 csv 文件
import csv
(2)打开已存在的 csv 文件
使用
with open()
语句打开已存在的 csv 文件,并将文件内容读入到table
变量中。
# 打开已存在的 csv 文件
with open('example.csv', 'r') as file:
reader = csv.reader(file
目录
首先导入 csv 库,以便读写 csv 文件
import csv
使用
with open()
语句打开已存在的 csv 文件,并将文件内容读入到table
变量中。
# 打开已存在的 csv 文件
with open('example.csv', 'r') as file:
reader = csv.reader(file