Mar-18-2019, 08:11 PM
Note that example_list is actually a set because its using {} not []
message = 'foo bar hello' example_list = {'foo bar', 'foo'} for item in example_list: if message.startswith(item): print(item)
Output:foo
foo bar