Script skips second for loop when reading a file

后端 未结 1 1116
太阳男子
太阳男子 2020-11-30 14:47

I am trying to read a log file and compare certain values against preset thresholds. My code manages to log the raw data from with the first for loop in my func

相关标签:
1条回答
  • 2020-11-30 15:17

    It is not skipping your second loop. You need to seek the position back. This is because after reading the file, the file offset will be placed at the end of the file, so you will need to put it back at the start. This can be done easily by adding a line

    datafile.seek(0);
    

    Before the second loop.

    Ref: Documentation

    0 讨论(0)
提交回复
热议问题