a = 'hello world' b = [] for i in a: if '%s:%s' % (i, a.count(i)) not in b: b.append('%s:%s' % (i, a.count(i))) print(b)
2023-12-03 14:04:04
a = 'hello world' b = [] for i in a: if '%s:%s' % (i, a.count(i)) not in b: b.append('%s:%s' % (i, a.count(i))) print(b)