以下是我的代码:
with open(filename, 'r') as f:
vectors = {}
for line in f:
vals = line.rstrip().split(' ')
vectors[vals[0]] = vals[1:]
它得到了:进程以退出代码137结束(由信号9中断:SIGKILL)。我应该如何优化我的代码?
答案 0 :(得分:-1)
试试这样:
with open(filename, 'r') as f:
vectors = {}
for line in f.readlines():
vals = line.rstrip().split(' ')
vectors[vals[0]] = vals[1:]