<p>使用以下命令:</p>
<pre class="lang-py prettyprint-override"><code>re.sub(r'(?<![ \t])[A-Z](?:[ \t][A-Z])+(?![ \t])', lambda x: x.group().replace(' ','').replace('\t',''), i)
</code></pre>
<p>查找空格/制表符分隔的单词,并从找到的文本中删除空格/制表符</p>
<p><strong>解释</strong></p>
<pre class="lang-py prettyprint-override"><code>
(?<! look behind to see if there is not:
[ \t] any character of: ' ', '\t' (tab)
) end of look-behind
[A-Z] any character of: 'A' to 'Z'
(?: group, but do not capture (1 or more times
(matching the most amount possible)):
[ \t] any character of: ' ', '\t' (tab)
[A-Z] any character of: 'A' to 'Z'
)+ end of grouping
(?! look ahead to see if there is not:
[ \t] any character of: ' ', '\t' (tab)
) end of look-ahead
</code></pre>