New line with ConfigParser - PYTHON
<p>I have a config file using configParser:</p>

<pre><code>&lt;br&gt;
[ section one ]&lt;br&gt;
one = Y,Z,X &lt;br&gt;&lt;br&gt;
[EG 2]&lt;br&gt;
ias = X,Y,Z&lt;br&gt;
</code></pre>

<p>My program works fine reading and proccessing these values. </p>

<p>However some of the sections are going to be quite large, I need a config file that will allow the values to be on a new line, like this:</p>

<pre><code>[EG SECTION]&lt;br&gt;
EG=&lt;br&gt;
item 1 &lt;br&gt;
item 2 &lt;br&gt;
item 3&lt;br&gt;
etc...
</code></pre>

<p>In my code i have a simple function that takes a delimeter (or seperator) of the values using <code>string.split()</code> obviously now set to comma. I have tried the escape string of <code>\n</code> which does not work. </p>

<p>Does anyone know if this is possible with pythons config parser?<BR>
<a href="http://docs.python.org/library/configparser.html" rel="nofollow">http://docs.python.org/library/configparser.html</a></p>

<pre><code>#We need to extract data from the config 
def getFromConfig(currentTeam, section, value, delimeter):
    cp = ConfigParser.ConfigParser()
    fileName = getFileName(currentTeam)
    cp.read(fileName)
    try:
        returnedString = cp.get(section, value)
    except: #The config file could be corrupted
        print( "Error reading " + fileName + " configuration file." )
        sys.exit(1) #Stop us from crashing later
    if delimeter != "": #We may not need to split
        returnedList = returnedString.split(delimeter)
    return returnedList
</code></pre>

<p>I would use for this :</p>

<pre><code>taskStrings = list(getFromConfig(teamName, "Y","Z",","))
</code></pre>
