擅长:python、mysql、java
<p>我将使用<code>rstrip()</code>和<code>split()</code>功能使用不同的方法处理正则表达式:</p>
<pre><code>list_strings = ['[ABC1: text1]', '[[DC: this is a text]]', '[ABC-O: potatoes]', '[[C-DF: hello]]']
cleaned = [s.split(': ')[1].rstrip(']') for s in list_strings]
print(cleaned) # ['text1', 'this is a text', 'potatoes', 'hello']
</code></pre>