擅长:python、mysql、java
<p>我在<a href="http://docs.python.org/library/configparser.html" rel="noreferrer">the configparser manual</a>中没有看到任何内容,但是您可以使用字符串的<code>.strip</code>方法去掉前导双引号和尾随双引号。</p>
<pre><code>>>> s = '"hello world"'
>>> s
'"hello world"'
>>> s.strip('"')
'hello world'
>>> s2 = "foo"
>>> s2.strip('"')
'foo'
</code></pre>
<p>如您所见,<code>.strip</code>如果字符串没有以指定的字符串开头和结尾,则不会修改该字符串。</p>