How to avoid quotes from a comma separated string joined from a list in python
<p>I have created a comma separated string by joining strings from a list in Python 3.5 and use it to write it to an INI file using configobj. Here is a sample Python script used in a Ubuntu 16.04 terminal:</p>

<pre><code>sudo python3 &lt;&lt; EOP
from configobj import ConfigObj

config=ConfigObj("myconfig.ini")
config['items']={}
itemlist=('item1','item2')
csvstr=",".join(list)
config['items']['itemlist'] = csvstr
config.write()
EOP
</code></pre>

<p>This writes the string with quotes as "item1,item2" as shown below. </p>

<pre><code>[items]
itemlist = "item1,item2"
</code></pre>

<p>However, if the items are joined with other characters such as ";", it writes the string without quotes! How to make it write the comma separated string without quotes?</p>

<p>Appreciate for any tips or solution.</p>

<p>Another solution is to use the <code>list_values</code> keyword:</p>

<pre><code>config = ConfigObj('myconfig.ini', list_values=False)
</code></pre>

<p><a href="https://configobj.readthedocs.io/en/latest/configobj.html#configobj-specifications" rel="nofollow">As the documentation says</a>, if <code>list_values=False</code> then single line values are not quoted or unquoted when reading and writing.</p>

<p>The result:</p>

<pre><code>[items]
itemlist = item1,item2
</code></pre>

python string csv quotes