How to split a list based on a condition? September 25, 2022 by Tarik good, bad = [], [] for x in mylist: (bad, good)[x in goodvals].append(x)