Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
像这样:
我爱 => 我爱
只需要在两个单词之间加一个空格。
如果两个词都大写,
import re re.sub(r'([a-zA-Z])([A-Z])', r'\1 \2', 'ILove') # => 'I Love'
这基本上是在任何大写字母之前插入一个空格,前提是大写字母前面有一个字母。