Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python counter to list of tuples

from collections import Counter
result = list(Counter(example).items())
[('apple', 2), ('pear', 1)]
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #counter #list #tuples
ADD COMMENT
Topic
Name
7+1 =