Python Forum
[split] How to write at a very specific position of a text file
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[split] How to write at a very specific position of a text file
#1
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?
Reply
#2
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...?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Extracting specific file from an archive tester_V 4 428 Jan-29-2024, 06:41 PM
Last Post: tester_V
  Last record in file doesn't write to newline gonksoup 3 366 Jan-22-2024, 12:56 PM
Last Post: deanhystad
  write to csv file problem jacksfrustration 11 1,375 Nov-09-2023, 01:56 PM
Last Post: deanhystad
  python Read each xlsx file and write it into csv with pipe delimiter mg24 4 1,315 Nov-09-2023, 10:56 AM
Last Post: mg24
Sad How to split a String from Text Input into 40 char chunks? lastyle 7 1,054 Aug-01-2023, 09:36 AM
Last Post: Pedroski55
  Color a table cell based on specific text Creepy 11 1,858 Jul-27-2023, 02:48 PM
Last Post: deanhystad
  How to "tee" (=split) output to screen and into file? pstein 6 1,292 Jun-24-2023, 08:00 AM
Last Post: Gribouillis
  How do I read and write a binary file in Python? blackears 6 6,020 Jun-06-2023, 06:37 PM
Last Post: rajeshgk
  Reading data from excel file –> process it >>then write to another excel output file Jennifer_Jone 0 1,048 Mar-14-2023, 07:59 PM
Last Post: Jennifer_Jone
  Read text file, modify it then write back Pavel_47 5 1,502 Feb-18-2023, 02:49 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020