- 论坛徽章:
- 0
|
新手读文件每一列到不同数组,想要实现:把文件每一列读到X,Y,Z,M,N,P六个数组变量里,不知是否用split时出问题,请专家指教,多谢!
文件:
100 -0.4048042307692307 0.8769215384615385 -0.2216050877192982 1.170111929824562 -0.3835615686274509 1.135115882352941
200 -3.9815161290322594E-002 0.9006469354838712 -7.0497096774193566E-002 1.751956451612903 3.1567586206896543E-002 1.904926551724138
300 -0.1056375806451613 0.5910174193548384 -5.5485161290322611E-002 1.216885645161290 0.2960327586206897 1.503098793103449
400 -6.8811290322580654E-002 0.5443600000000000 -0.2423662903225806 1.069093225806452 -0.2317336206896551 1.153844482758620
500 -5.2081129032258068E-002 0.5398933870967743 -0.1479479032258064 0.9731033870967742 -0.1644389655172414 1.089722241379310
700 -8.4022741935483855E-002 0.4949438709677419 -0.1191772580645161 0.9848732258064516 -1.4285000000000004E-002 1.112426896551724
850 1.7479032258064506E-002 0.6342377419354837 0.2570740322580645 1.523015967741936 0.3013170689655172 1.687753448275862
925 9.4898709677419354E-002 0.6424733870967740 0.2575030645161290 1.484546612903225 0.3213170689655172 1.606212586206897
1000 0.1066361666666666 1.018210166666667 0.1156121311475410 1.813417540983606 -5.1460877192982514E-002 2.065553333333333
读文件部分的代码:
with open('./high_result_bmb/TMP_fc_00-24_201406.txt','r') as fbmb :
list=[]
for line in fbmb.readlines():
list = line.split()
print list[1]
报如下出错信息:
File "readfile.py", line 15
print list[1]
^
IndentationError: unexpected indent
|
|