我有一个这样格式的输入文件
{A}
4.240000 1.593631 1.593631
4.240000 -1.593631 1.593631
4.240000 -1.593631 -1.593631
4.240000 1.593631 -1.593631
{B}
-4.240000 -1.593631 -1.593631
-4.240000 1.593631 -1.593631
{C}
...
我想读{A},保存下面的数组,使用数组,然后移到{B}执行同样的操作,。。。你知道吗
我有这样的东西
import sys
#Read file
inFile = sys.argv[1]
with open(inFile) as vfile:
line = vfile.readline()
while line:
if line.find("{") == 0:
A = line.split('\n')
else:
line.split()
array = []
line = [int(i) in line]
array.append(line)
print(A, array)
你会得到如下数据:
相关问题 更多 >
编程相关推荐