If I have a string and want to return a word that includes a whitespace how would it be done?
For example, I have:
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']
So ME ME does not get printed because of the whitespace.
Thanks
You could just keep it simple:
Think about speed only if it proves to be too slow in practice.