擅长:python、mysql、java
<p>一种可能是将字符串拆分,然后将其连接起来,对每个块应用不同的处理:</p>
<pre><code>test_str = "election laws \" are outmoded or inadequate and often ambiguous \" and should be changed."
print(test_str)
test=test_str.split("\"")
test[1]=test[1].strip()
test = "\"".join(test)
print(test)
</code></pre>