[Tutor] ideas on how to process a file

Alan Gauld alan.gauld at btinternet.com
Fri Apr 10 17:24:21 CEST 2009

"Spencer Parker" <inthefridge at gmail.com> wrote in message

>I have a flat file database that I want to get information from.  The 
> text looks like this:
> ITEM    {
>        "FULLNAME"      "apps114.chgit.com!file:/etc"
>        "RECOVERY"      "0"
> }
> They are all on a separate line in the text file.  I had thought about
> trying to drop it into a list or a dictionary.  Most likely a dictionary.

What would be the key and what would be the data?

With a regular structure delimited by braces you should be able
to process the file line by line fairly easily.

> thought about using regular expressions to pull the data I need.

You probably don;t need regex, but it depends on what exactly
you want to filter/extract.


Alan Gauld
Author of the Learn to Program web site

More information about the Tutor mailing list