ConfigParser and multiple option names

alisonken1 alisonken1 at gmail.com
Tue May 2 17:46:04 EDT 2006


Florian Lindner wrote:
> Hello,
> since ConfigParser does not seem to support multiple times the same option
> name, like:
>
> dir="/home/florian"
> dir="/home/john"
> dir="/home/whoever"
<snip>

Another option would be to switch to the XMLParser library and use an
XML file for the configuration.

That way, you can build using the same name:

#==== config_file.xml ====
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE options>
<options>
    <directories>
        <path>"/home/florian"</path>
        <path>"/home/john"</path>
        <path>"/home/whoever"</path>
    </directories>
    {other options}
</options>
#==== config_file.xml ====

There are also several tutorials
<a
href="http://uche.ogbuji.net/tech/akara/nodes/2003-01-01/pyxml-akara">
Uche Ogbuji's Akara site
</a>

has some excellent XML tutorials which include python XML processing.




More information about the Python-list mailing list