On Tue, Dec 2, 2008 at 1:18 PM, RON BRENNAN <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I have a very simple ini file that I needs parsed.  What is the best way I
> can parse an ini file that doesn't include sections?
>
> As in:
>
Since it appears that ConfigParser requires at least one section
header, I'll assume the file starts with the following line:

[main]
> person=tall
> height=small
> shoes=big
>
>
> Thats it.  Can anyone help me?

Completely untested:

import ConfigParser
config = ConfigParser.RawConfigParser()
config.readfp(open("path/to/file.cfg"))
config.get("main", "height") #==> "small"

Cheers,
Chris
-- 
Follow the path of the Iguana...
http://rebertia.com

>
> Thanks,
> Ron
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to