I have learned that there are 'r'
mode for read, 'w'
for write, and 'a'
for appending. And we have also have the '+', 't' 'b'
combination.
if I use 'a' or 'a+', I can only append new writings at the end.
even if I use 'r+', I can only write in specific locations to cover the old content. Example: original 123456, if I f_obj.seek(2)
and f_obj.write('abc')
, it will become 12abc6
So is there a way I can write at seek(2)
and end up with 12abc3456
?