Text Files lines

Textfile example:

3
2
5
7
9

I want to know how i can for example add to line 3 or read only line 4, in other words assign each line to a function.

I didn't find anything on the internet although i think i used the wrong terms as it seems as an easy task but still can't figure out the syntax.
Thanks.
You have to read the lines into memory, apply your changes, and if you want them saved write them out again. You can't manipulate the file directly as if it were memory.
Topic archived. No new replies allowed.