Created
January 7, 2018 20:38
-
-
Save milothiesen/84847e87c0ab064e5aa0dccd3dde8238 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pprint | |
arr = [{ | |
"codec": "MPEG", | |
"wrapper": "mov", | |
"commerical": "Pro Res" | |
}, | |
{ | |
"codec": "MPEG-4", | |
"wrapper": "mp4", | |
"commerical": "" | |
}, | |
{ | |
"codec": "MPEG", | |
"wrapper": "m4v", | |
"commerical": "Random" | |
}, | |
{ | |
"codec": "MPEG-4", | |
"wrapper": "mp4", | |
"commerical": "" | |
}, | |
{ | |
"codec": "MPEG-4", | |
"wrapper": "mp4", | |
"commerical": "" | |
}, | |
{ | |
"codec": "MPEG-4", | |
"wrapper": "mp4", | |
"commerical": "" | |
}, | |
{ | |
"codec": "MPEG", | |
"wrapper": "mov", | |
"commerical": "Pro Res" | |
}, | |
{ | |
"codec": "MPEG", | |
"wrapper": "mov", | |
"commerical": "Pro Res" | |
}, | |
{ | |
"codec": "MPEG", | |
"wrapper": "mov", | |
"commerical": "Pro Res" | |
}] | |
sortedlist = [] | |
sortedlist_with_count = [] | |
for item in arr: | |
if item not in sortedlist: | |
sortedlist.append(item) | |
for x in sortedlist: | |
x['zCount'] = arr.count(x) | |
sortedlist_with_count.append(x) | |
for item in sortedlist_with_count: | |
pp = pprint.PrettyPrinter(depth=6) | |
pp.pprint(item) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment