用python完成以下需求:将CUsersUnaDesktopBatteryMonitor1_modifiedcsv列名为Variation的数据抓取为一个数组数据中间用隔开整组数据在内请示例代码
import csv
定义数据文件路径
file_path = "C:\Users\Una\Desktop\BatteryMonitor1_modified.csv"
定义结果数组
result = []
打开数据文件
with open(file_path, 'r') as file: # 创建CSV读取器 csv_reader = csv.DictReader(file)
# 遍历每一行数据
for row in csv_reader:
# 将Variation列的数据添加到结果数组
result.append(row['Variation'])
打印结果数组
print(result)
原文地址: http://www.cveoy.top/t/topic/jcUQ 著作权归作者所有。请勿转载和采集!