Quantcast
Channel: How to turn an itertools "grouper" object into a list - Stack Overflow
Browsing all 2 articles
Browse latest View live

Answer by PM 2Ring for How to turn an itertools "grouper" object into a list

The reason that your first approach doesn't work is that the the groups get "consumed" when you create that list with list(groupby("cccccaaaaatttttsssssss"))To quote from the groupby docsThe returned...

View Article



How to turn an itertools "grouper" object into a list

I am trying to learn how to use itertools.groupby in Python and I wanted to find the size of each group of characters. At first I tried to see if I could find the length of a single group:from...

View Article
Browsing all 2 articles
Browse latest View live




Latest Images

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