Writing to a certain line?
rookswood at suburbian.com.au
Fri Jun 9 08:08:51 CEST 2006
"Tommy B" <tommy04 at gmail.com> writes:
>I was wondering if there was a way to take a txt file and, while
>keeping most of it, replace only one line. See, I'd have a file like:
>Is there any easy way to do this?
An easy way? If you know how many bytes in from the start of the file
your desired changes are to be positioned, the utility of choice is
the strange but wonderful "dd" for Unix, MSwindows, MSDOS, etc.
That's its name: dd. Are you planning to execute a call to dd from within
a python program? Of course, you are constrained to substituting N bytes
with another N bytes, exactly.
John Savage (my news address is not valid for email)
More information about the Python-list