最简单的方法是使用regex并在单词上进行拆分。
result = [] for word in re.split('\W+', my_string): if word.startswith('K'): if result: print result result = [] else: result.append(word) if result: print(result)