Python: Mixing files and loops -


I am writing a script that logs errors from another program and restores the program where it The error has to be faced. For whatever reasons, the developers of this program did not necessarily consider this functionality as their program by default.

Anyway, the program takes an input file, parses it, and creates an output file in the input file in a specific format:

UI - 26474845 TI - Title ( AB can be any number) AB - abstract (can be in any number)

When the program throws an error, it gives you the necessary reference information to track the error - That is, the UI, which is the section (title or summary), and title or title of the essence The beginning of the relative line number. I want to log the offensive sentences from the function with the function which takes the reference number and file, finds the sentence, and logs it. The best way I can think of doing this is to proceed through the file For a specific number of times (i.e., n time, where n is the line number relative to the beginning of centin). The way it seemed to be understood:

  i = 1 while i  

I do not know how it will lose data, but Python thinks this happens, and the value says: Run an error And read ways will lose data. Does anyone know how to do it properly?

You get ValueError because maybe in your code for the line in the original: Additionally root.readline () . An easy solution that resolves the problem without slowing down your program or consume more memory

  for the line at the root: ...  

To

  while correct: line = original.readline () if not line: break ...  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -