0

so open a text file, and insert text at a specific position (counted in characters) in the file?

I was thinking something along the lines of...

def insert_text(filename, text_to_insert, position):
    with open(filename, "w") as file:
         for line in file:
            for ch in line:
                if ch is position:
                    #insert text at position?
lsch91
  • 335
  • 3
  • 11

0 Answers0