How to list unique elements from a counter in Python

1 Answer

0 votes
from collections import Counter

counter = Counter()
for ch in "python programming":
    counter[ch] += 1

print(list(counter))



'''
run:

['p', 'y', 't', 'h', 'o', 'n', ' ', 'r', 'g', 'a', 'm', 'i']
 
'''

 



answered Jul 26, 2019 by avibootz

Related questions

1 answer 180 views
1 answer 143 views
1 answer 145 views
1 answer 166 views
...