如何解决CSV导入问题?

2024-03-28 12:02:47 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试从CSV文件导入此数据

location    scale
 0.90109    0.63551
0.59587     0.65525
0.80460     0.64227
0.65178     0.65198
0.76307     0.64503
0.52575     0.65915
0.41322 0.66496
0.30059 0.67022
0.21620     0.67382
0.17404 0.67552
-0.05027    0.68363
-0.0782 0.68454

使用此代码。你知道吗

test=[]
import csv
f=open("data.csv")
for row in csv.reader(f):
    test.append(row)

但是当我打开测试文件时,我得到了一些\xao编码。你能告诉我怎么修吗?你知道吗

我只想在导入变量后对数据执行一些操作。你知道吗

enter image description here


Tags: 文件csv数据代码intestimportfor