I am trying to not print consecutive duplicates with a zip list but I am a little confused about the tuple structure here. If it were a simple list I would either use groupby or something simple like if y[i] != y[i-1] but this does not work here. I also can't seem to append it to a list which I tried... I am missing something in the details here.
and example input would be:
aa b aa aa b c
which would give me:
aa b aa b c
here is my code so far:
from __future__ import print_function
import sys
in_file = sys.argv[1]
with open(in_file) as f:
do stuff not related to this question...
for x in zip(*lis):
for y in x :
if y[i] != y[i-1]:
print(y+' ', end='')
print('\n')
Sorry if this question is confusing, feel free to make any changes to help others :-)