KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
The code I have now: from collections import Counter c=Counter(list_of_values) returns: Counter({'5': 5, '2': 4, '1': 2, '3': 2}) I want to sort this list into numeric(/alphabetic) order by item, not number of occurrences. How can I convert this into a list of pairs such as: [['5',5],['2',4],['1',2],['3',2]] Note: If I use c.items(), I get: dict_items([('1', 2), ('3', 2), ('2', 4), ('5', 5)]) which does not help me... Thanks in advance!
Tags (comma-separated)
Save Edits
Cancel