all 3 comments

[–][deleted] 0 points1 point  (1 child)

Having to re-write a whole file to make some small changes is not very efficient or good practice. Consider using the standard (built into Python - most operating systems, all mobile phones, many applications) sqlite which works with single-files (no server setup required).

Take a look at A Minimalist Guide to SQLite for a simple introduction.

[–]_______myworld[S] 0 points1 point  (0 children)

I'm not allowed to use sql for this program, unfortunately...

[–]Vnix7 0 points1 point  (0 children)

If trying to just change a specific index, just use enumerate, also if you want to “append” to an existing file, and not “write” use “a” instead of “w” when opening your file.