0
我想從一個CSV導入此數據文件如何解決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編碼。你能告訴我如何解決這個問題嗎?
我想要做的就是在導入到變量後對數據執行一些操作。
'.replace(u'\ xa0',u'')'first? – 2014-10-20 17:47:29
或'test.append([item.replace(u'\ xa0',u'')爲行]]'' – 2014-10-20 17:56:01
謝謝。但現在每個數字都有一個U infront ...... – maximusyoda 2014-10-20 18:01:32