擅长:python、mysql、java
<p>我不确定你想提取什么,所以我猜。我建议使用<code>partition</code>和<code>rpartition</code>字符串方法。你知道吗</p>
<p>这是你想要的吗?你知道吗</p>
<pre><code>>>> samples = [
... 'Prefix content. "Some content goes here". More contents without quotes.',
... 'Prefix content. "Another "Additional" goes here". More contents without quotes.',
... 'Prefix content. "Just another "content". More contents without quotes.',
... ]
>>> def get_content(data):
... return data.partition('"')[2].rpartition('"')[0]
...
>>> for sample in samples:
... print get_content(sample)
...
Some content goes here
Another "Additional" goes here
Just another "content
</code></pre>