Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

remove from list if not maches in list

>>sents = ['@$	this sentences needs to be removed', 'this doesnt',
     '@$	this sentences also needs to be removed',
     '@$	this sentences must be removed', 'this shouldnt',
     '# this needs to be removed', 'this isnt',
     '# this must', 'this musnt']
>>>[x for x in sents if not x.startswith('@$	') and not x.startswith('#')]
['this doesnt', 'this shouldnt', 'this isnt', 'this musnt']
 
PREVIOUS NEXT
Tagged: #remove #list #maches #list
ADD COMMENT
Topic
Name
9+5 =