simultaneous reading and writing a textfile
Marco Herrn
marco.herrn at sourcepark.de
Wed May 17 04:43:21 EDT 2006
On 2006-05-16, Peter Otten <__peter__ at web.de> wrote:
>> Now how can I achieve, what I want? Really exchange one line with
>> another, regardless of their length. Is this possible? If this is not
>> possible, then what would be the best approach to do this?
>
> A file is exposed as a sequence of bytes. You can only exchange a string of
> bytes with the same number of (different) bytes. Inserting or removing
> bytes means you have to rewrite the file from the insertion/deletion point
> onwards. Usually you don't bother and just rewrite the whole file.
Thanks to you both. I will use that. I do not think, that the files
will be that large, that a database is useful. The main advantage of
the file is, that it is directly human readible.
Regards
Marco
More information about the Python-list
mailing list