Python Forum
[split] How to write at a very specific position of a text file - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: [split] How to write at a very specific position of a text file (/thread-7979.html)



[split] How to write at a very specific position of a text file - Lalit - Feb-01-2018

Hello Folks,
I need to write at a very specific position of a text file and then i have to delete the same content , i have to do it in one loop ,i am having one list which is updating the name at every iteration ,can you please suggest how i can do this?


RE: [split] How to write at a very specific position of a text file - dalwood - Feb-01-2018

I'm having a difficult time following your requirements. Reading them literally, it appears they are:

Given:
"Here is my file content."
When I replace position (for ex.) 5 (assuming zero offset) with 'x', the result should be:
"Here xs my file content."
Then I need to delete that 'x':
"Here s my file content."

I also don't follow what name is being updated.

Maybe you can provide some sample input and some pseudocode...?