如何通过信号解决中断9:SIGKILL?

时间:2017-08-01 05:52:10

标签: python

以下是我的代码:

 with open(filename, 'r') as f:
    vectors = {}
    for line in f:
        vals = line.rstrip().split(' ')
        vectors[vals[0]] = vals[1:]

它得到了:进程以退出代码137结束(由信号9中断:SIGKILL)。我应该如何优化我的代码?

1 个答案:

答案 0 :(得分:-1)

试试这样:

with open(filename, 'r') as f:
    vectors = {}
    for line in f.readlines():
        vals = line.rstrip().split(' ')
        vectors[vals[0]] = vals[1:]