b = '11,22,11,'b = b.split(',')d = ''for c in b: if c not in d: d += str(c) d += ',' else: passd = d[:-1]print(d)