unwanted = {'item', 5}
item_list = [e for e in item_list if e not in unwanted]
item_list = ['item', 5, 'foo', 3.14, True]
list_to_remove = ['item', 5, 'foo']
final_list = list(set(item_list) - set(list_to_remove))
# Python program to remove empty tuples from a
# list of tuples function to remove empty tuples
# using list comprehension
def Remove(tuples):
tuples = [t for t in tuples if t]
return tuples
# Driver Code
tuples = [(), ('ram','15','8'), (), ('laxman', 'sita'),
('krishna', 'akbar', '45'), ('',''),()]
print(Remove(tuples))
mylist=['a','b','c','d','e','f','g','h','i']
newlist = mylist[2:-2]