update from Atlas
This commit is contained in:
19
concurrency/flags/cc_count.py
Normal file
19
concurrency/flags/cc_count.py
Normal file
@@ -0,0 +1,19 @@
|
||||
|
||||
from collections import Counter
|
||||
from operator import itemgetter
|
||||
from string import ascii_uppercase
|
||||
|
||||
with open('country-codes.tab') as fp:
|
||||
ct = Counter()
|
||||
for line in fp:
|
||||
if line.startswith('#'):
|
||||
continue
|
||||
cc, _, _ = line.split('\t')
|
||||
ct[cc[0]] += 1
|
||||
print(cc, end=' ')
|
||||
|
||||
for key, value in sorted(ct.items(), key=itemgetter(1), reverse=True):
|
||||
print(key, value)
|
||||
|
||||
print('Total:', sum(ct.values()))
|
||||
print('Missing:', ', '.join(set(ascii_uppercase) - ct.keys()))
|
||||
Reference in New Issue
Block a user