擅长:python、mysql、java
<p> <a href="https://docs.python.org/3/library/stdtypes.html#str.strip">^{<cd1>}</a>从字符串的开头或结尾移除字符,而不是在中间。</p>
<pre><code>>>> ',hello, world,'.strip(',')
'hello, world'
</code></pre>
<p>如果要从任何位置删除字符,应使用<a href="https://docs.python.org/3/library/stdtypes.html#str.replace">^{<cd2>}</a>代替:</p>
<pre><code>>>> 'hello, world'.replace(',', '')
'hello world'
</code></pre>