Spaces:
Running
Running
from collections import OrderedDict | |
lang_codes = OrderedDict() | |
with open("lang_code.txt", "r") as file: | |
for line in file: | |
line = line.strip() | |
if line.startswith("----"): | |
continue | |
iso, lang = line.split("\t", 1) | |
lang_codes[lang + "(" + iso + ")"] = iso | |
# print(lang_codes) | |
print(len(lang_codes)) | |
language_names = list(lang_codes.keys()) | |
print(language_names) | |
print(lang_codes[language_names[0]]) | |