Python - Split a string but keep contiguous uppercase letters [duplicate]
问题 This question already has answers here : Splitting on group of capital letters in python (3 answers) Closed 26 days ago . I would like to split strings to separate words by capital letters, but if it contains contiguous uppercase letters, split it to one word until before the final letter (that probably starts a new word..) For example: splitThreeWords -> [split, three, words] SplitThreeWords -> [split, three, words] ILOSummit -> [ILO, summit] 回答1: Use re.split with a capturing group (to keep