1
test3.csv包含一列有33個數字的列。我想將這一列重新塑造成11行3列。然後,我想將新的ascii文件保存爲附加圖像的行和列。將帶有一列的CSV文件轉換爲帶有多列的ASCII文件
首先嚐試:
import csv
f = open('test3.csv')
csv_f = csv.reader(f)
for row in csv_f:
print row /* The result is
結果是:
['0.000016'] ['0.000045'] ['0.000062'] ['0.000063'] ['0.000063'] ['0.000063']... **[' ']** means string?
第二個嘗試:
f = open('test3.csv')
csv_f = csv.reader(f)
for row in csv_f:
print row[0]
結果是:
0.000016 0.000045 0.000062 0.000063 0.000063 0.000063 ...I think they are number.
第三次嘗試:
import csv
import numpy as np
f = open('test3.csv')
csv_f = csv.reader(f)
a1 = []
for row in csv_f:
a1.append(row[0])
print a1
結果是:
['0.000016', '0.000045', '0.000062', '0.000063', '0.000063', '0.000063',...].
其實我想這個結果像ASCII文件: