Python database of plain text editable by notepad or vi

Jon Clements joncle at googlemail.com
Thu Mar 25 18:56:22 EDT 2010


On 25 Mar, 22:40, James Harris <james.harri... at googlemail.com> wrote:
> I am looking to store named pieces of text in a form that can be
> edited by a standard editor such as notepad (under Windows) or vi
> (under Unix) and then pulled into Python as needed. The usual record
> locking and transactions of databases are not required.
>
> Another way to look at it is to treat the separate files as entries in
> a dictionary. The file name would be the key and the lines of the file
> the value.
>
> Anyone know of a database (with a Python interface) which will allow
> text files to be treated as database fields? If not I can just write
> it but I thought it best to ask if there was an existing solution
> first.
>
> James

I could be missing something here, but aren't you basically just
talking about an OS's filesystem?

glob or listdir somewhere, then create a dict using the file contents
would meet your criteria, with very little lines of code -- but I
would be interested to know what the use-case was for this... Is it
read completely at start up time, or if each file contains a large
amount of lines and aren't fixed width (or has no other indexing
support without maintenance), then is a complete sequential-scan
required each time, or do you just tell the user to not update when
running (unless I s'pose something along the lines of a SIGHUP for
config files is applicable).

Sorry, just don't understand why you'd want this.

Jon.



More information about the Python-list mailing list