如果我有一个字符串并想返回一个包含空格的单词,该怎么做?
例如,我有:
line = 'This is a group of words that include #this and @that but not ME ME'
response = [ word for word in line.split() if word.startswith("#") or word.startswith('@') or word.startswith('ME ')]
print response ['#this', '@that', 'ME']
所以 ME ME 因为空白而没有被打印出来。
谢谢