remove from list if not maches in list

Solutions on MaxInterview for remove from list if not maches in list by the best coders in the world

showing results for - "remove from list if not maches in list"
Emanuele
04 Mar 2016
1>>sents = ['@$\tthis sentences needs to be removed', 'this doesnt',
2     '@$\tthis sentences also needs to be removed',
3     '@$\tthis sentences must be removed', 'this shouldnt',
4     '# this needs to be removed', 'this isnt',
5     '# this must', 'this musnt']
6>>>[x for x in sents if not x.startswith('@$\t') and not x.startswith('#')]
7['this doesnt', 'this shouldnt', 'this isnt', 'this musnt']