Created
May 22, 2018 10:40
-
-
Save kijart/770ba85a2923bc96f2286c2b4f6707be to your computer and use it in GitHub Desktop.
Hash map tests in Python
This file contains 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
country_languages = { | |
'AT': ['de-AT', 'en', 'fr'], | |
'CH': ['de-CH', 'en', 'fr'], | |
'DE': ['de-DE', 'en', 'fr'], | |
} | |
languages_hash = {} | |
for country_code, language_codes in country_languages.items(): | |
for language_code in language_codes: | |
locale = language_code.split('-')[0] | |
if not country_code in languages_hash: | |
languages_hash[country_code] = {} | |
if not language_code in languages_hash[country_code]: | |
languages_hash[country_code][locale] = {} | |
languages_hash[country_code][locale] = {} | |
print(language_hash) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment