Why not use:
groups = [[], []]
instead if you are going to append to two groups? Then you won't run into that problem.
You can always remove it again if it remains empty, or you can use exception handling:
elif tuple[0]==2:
try:
groups[1].append(r)
except IndexError:
groups.append([r])
as the list missing is only a problem once.