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.
所以我需要识别模式“X”或“spaceCAPITAL”示例:
string="Hello World, This is KZ"
该程序会选择:
example_list = [W,T,K]
>>> import re >>> strs = "Hello World, This is KZ" >>> re.findall(r'\s([A-Z])', strs) ['W', 'T', 'K']
尝试这个:
import re re.findall(' ([A-Z])', string)