My code is as follows:
from itertools import groupby for key, group in groupby(warnstufe2, lambda x: x[0]): for element in group: a = element[1:4] b = element[4:12] c = [a,b] print(c)
When I type (c), I get something like this:
[(a,b,c),(d,e,f)] [(g,h,i),(j,k,l)]
where a1 = (a, b, c) and b1 = (d, e, f) and a2 = (g, h, i) and b2 = (j, k, l). Of course there is a3 ... and b3 ... However, I need something like this:
[(a,b,c),(d,e,f),(g,h,i),(j,k,l)]
I already tried the for loop through c:
for item in c: list1 = [] data = list1.append(item)
But this did not help and led to:
None None
based on this link: https://mail.python.org/pipermail/tutor/2008-February/060321.html
It seems to me that this is easy, but I am new to python and have not yet found a solution, despite a lot of reading. I appreciate your help!