On Sat, Dec 18, 2021 at 2:32 AM ast <ast@invalid> 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("aahfffddssssnnb")] > 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. >
https://docs.python.org/3/library/itertools.html#itertools.groupby Check the explanatory third paragraph :) ChrisA -- https://mail.python.org/mailman/listinfo/python-list