On Fri, 17 Dec 2021 09:25:03 +0100, ast wrote:
[snip]
>
> but:
>
> li = [grp for k, grp in groupby("aahfffddnnb")]
> list(li[0])
>
> []
>
> list(li[1])
>
> []
>
> It seems empty ... I don't understand why, this is
> the first read of an iterator, it should provide its
> data.
Baffling. Here'
On Sat, Dec 18, 2021 at 2:32 AM ast wrote:
>
> Python 3.9.9
>
> Hello
>
> I have some troubles with groupby from itertools
>
> from itertools import groupby
>
> li = [grp for k, grp in groupby("aahfffddnnb")]
> list(li[0])
>
> []
>
> list(li[1])
>
> []
>
> It seems empty ... I don't understand
but:
li = [grp for k, grp in groupby("aahfffddnnb")]
list(li[0])
[]
list(li[1])
[]
It seems empty ... I don't understand why, this is
the first read of an iterator, it should provide its
data.
The group-iterators are connected. Each group-iterator is a wrapper
around the original it
Python 3.9.9
Hello
I have some troubles with groupby from itertools
from itertools import groupby
for k, grp in groupby("aahfffddnnb"):
print(k, list(grp))
print(k, list(grp))
a ['a', 'a']
a []
h ['h']
h []
f ['f', 'f', 'f']
f []
d ['d', 'd']
d []
s ['s', 's', 's', 's']
s []
n ['n