randomly write to a file

rohit rohitsethidce at gmail.com
Mon May 7 18:36:35 EDT 2007


nick,
i just wanted to ask for time constrained applications like searching
won't sqlite be a expensive approach.
i mean searching and editing o the files is less expensive by the time
taken .
so i need an approach which will allow me writing randomly to a line
in file without using a database
On May 8, 2:41 am, Nick Vatamaniuc <vatam... at gmail.com> wrote:
> Rohit,
>
> Consider using an SQLite database. It comes with Python 2.5 and
> higher.  SQLite will do a nice job keeping track of the index. You can
> easily find the line you need with a SQL query and your can write to
> it as well. When you have a file and you write to one line of the
> file, all of the rest of the lines will have to be shifted to
> accommodate, the potentially larger new line.
>
> -Nick Vatamaniuc
>




More information about the Python-list mailing list