I need to count the number of identical rows running. For this, I use itertools.groupby .
Question: how to determine the number of elements in a group? len (grop) does not work. Does the object have any property like size ()?
data = (line.rstrip() for line in sys.stdin) for key, group in groupby(data): print(data.size())