2013-10-08 34 views
-5

嗨现在我能够从第一行读取,但是如果我使用[3] [1]它再次给我空字符串......我的代码有什么问题吗?它工作得很好用逗号Python - 阅读第二排开始

记事本文件夹要在Python

读取结果

它相隔3间距因此,我无法得到的结果是有办法解决这个问题?

@@New Section: Section 0:            
1 2 2 1 1 9 1 1 -2 2 1 -3 3 1 1 -1 8 
3 2 2 1 1 9 1 1 -2 2 1 -3 3 1 1 -1 8 
4 2 2 1 1 9 1 1 -1 1 1 -2 2 1 1 -1 8 

代码阅读记事本

reader = list(csv.reader(open(file_path_Inplane, 'rb'), delimiter=" ")) 
line = reader[3][0] 
Sat = line.split(' ') 
Sat = Sat[len(Sat)-1] 
line = reader[1][0] 
Coer = line.split(' ') 
Coer = Coer[len(Coer)-1] 

回答

0
with open(file_path_Inplane) as f: 
    f.readline() 
    for row in csv.reader(f, delimiter=' ')): 
     print(row[8]) 
+0

喜代码不读第2列 – user2837162