Quantcast
Channel: How can I partition (split up, divide) a list based on a condition? - Stack Overflow
Browsing all 41 articles
Browse latest View live

How can I partition (split up, divide) a list based on a condition?

I have some code like:good = [x for x in mylist if x in goodvals]bad = [x for x in mylist if x not in goodvals]The goal is to split up the contents of mylist into two other lists, based on whether or...

View Article

Browsing all 41 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>