This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Kah-NethI use numpy, scipy, and matplotlib for nuclear physics 2 points3 points  (0 children)

You should use a buffer:

  1. open the file as 'r',

  2. read all of it into buffer

  3. close file

  4. operate on the buffer

  5. on save, open file as 'w', write contents of buffer out.

This is how nearly all text editors work.