Split a list based on a condition
good = [x for x in mylist if x in goodvals]
bad = [x for x in mylist if x not in goodvals]
Split a list based on a condition
good = [x for x in mylist if x in goodvals]
bad = [x for x in mylist if x not in goodvals]
Split a list based on a condition
good, bad = [], []
for x in mylist:
(bad, good)[x in goodvals].append(x)
# good.append(x) if x in goodvals else bad.append(x)
# for x in mylist: (good if isgood(x) else bad).append(x)
# (good if x in goodvals else bad).append(x)
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us