How to remove an array containing certain strings from another array in Python -


example:

a = ['abc123','abc','543234','blah','tete','head','loo2'] 

so want filter out above array of strings following array b = ['ab','2']

i want remove strings containing 'ab' list along other strings in array following:

a = ['blah', 'tete', 'head'] 

you can use list comprehension:

[i in if not any(x in x in b)] 

this returns:

['blah', 'tete', 'head'] 

Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

php - joomla get content in onBeforeCompileHead function -