Re: randomly write to a file

2007-05-07 Thread Alex Martelli
Steven D'Aprano <[EMAIL PROTECTED]> wrote: ... > Hang on, as I understand it, Nick just suggesting using SQlite for > holding indexes into the file! That's why I said it was overkill. So > whether the indexes are in a list or a database, you've _still_ got to > deal with writing to the file. >

Re: randomly write to a file

2007-05-07 Thread Steven D'Aprano
On Mon, 07 May 2007 20:00:57 -0700, Alex Martelli wrote: > Steven D'Aprano <[EMAIL PROTECTED]> wrote: > >> On Mon, 07 May 2007 14:41:02 -0700, Nick Vatamaniuc wrote: >> >> > Rohit, >> > >> > Consider using an SQLite database. It comes with Python 2.5 and >> > higher. SQLite will do a nice job k

Re: randomly write to a file

2007-05-07 Thread Alex Martelli
Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Mon, 07 May 2007 14:41:02 -0700, Nick Vatamaniuc 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

Re: randomly write to a file

2007-05-07 Thread Steven D'Aprano
On Mon, 07 May 2007 14:41:02 -0700, Nick Vatamaniuc 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. Whe

Re: randomly write to a file

2007-05-07 Thread Steven D'Aprano
On Mon, 07 May 2007 12:51:37 -0700, rohit wrote: > i can read a specified line by using the module linecache but i am > struck as to how to implement writing to the n(th) line in a file > EFFICIENTLY > which means i don't want to traverse the file sequentially to reach the > n(th) line Unless you

Re: randomly write to a file

2007-05-07 Thread rohit
hi gabriel, i am utilizing file names and their paths which are written to a file on a singe line. now if i use records that would be wasting too much space as there is no limit on the no. of characters (at max) in the path. next best approach i can think of is reading the file in memory editing it

Re: randomly write to a file

2007-05-07 Thread rohit
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 M

Re: randomly write to a file

2007-05-07 Thread Nick Vatamaniuc
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

Re: randomly write to a file

2007-05-07 Thread Gabriel Genellina
En Mon, 07 May 2007 16:51:37 -0300, rohit <[EMAIL PROTECTED]> escribió: > i am developing a desktop search.For the index of the files i have > developed an algorithm with which > i should be able to read and write to a line if i know its line > number. > i can read a specified line by using the

Re: randomly write to a file

2007-05-07 Thread kyosohma
On May 7, 2:51 pm, rohit <[EMAIL PROTECTED]> wrote: > hi, > i am developing a desktop search.For the index of the files i have > developed an algorithm with which > i should be able to read and write to a line if i know its line > number. > i can read a specified line by using the module linecache

randomly write to a file

2007-05-07 Thread rohit
hi, i am developing a desktop search.For the index of the files i have developed an algorithm with which i should be able to read and write to a line if i know its line number. i can read a specified line by using the module linecache but i am struck as to how to implement writing to the n(th) lin