Answers for "delete everything from list that matches string"

0

delete everything from list that matches string

new_list = [x for x in old_list if not x.startswith('@$t') and not x.endswith('#')]

['this doesnt', 'this shouldnt', 'this isnt', 'this musnt']
Posted by: Guest on February-15-2022

Code answers related to "delete everything from list that matches string"

Python Answers by Framework

Browse Popular Code Answers by Language