string input: Tem1 = 'Hhelloo ookkee'
I want to make output like Tem1 = 'helo oke'
I have try this link form stackoverflow (Python: Best Way to remove duplicate character from string)
I've tried using itertools, but when saving in csv. the stored format is still the same with lots of duplicate characters
import itertools
tem1 = sum(val*(2**idx) for idx, val in enumerate(reversed(tem)))
if bit[0:8]==[1,0,0,1,1,0,0,1]:
cv2.putText(frame, "Text Print: " + chr(tem1) +".....", (50, 50), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2)
print(chr(tem1))
cv2.imshow('frame',frame)
if str(tem1)!='0':
row = ''.join(ch for ch, _ in itertools.groupby(f'{chr(tem1)}'))
# create csv file to save the data.
f.write(row)
best way to remove duplicate
NOTE: Order is important and this question is not similar to this one.