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)

  

相关文章: