Last active
February 29, 2024 05:25
-
-
Save mudongliang/e0de9053115e705017b38695389ecf69 to your computer and use it in GitHub Desktop.
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
import pycountry | |
import json | |
def check_iso_standard(src): | |
for college in src: | |
#print(college["alpha_two_code"]) | |
#print(college["country"]) | |
alpha2 = college["alpha_two_code"] | |
name = college["country"] | |
result = pycountry.countries.get(alpha_2=alpha2) | |
if result is None: | |
print(alpha2, "is not found in iso3166-1") | |
else: | |
if result.name != name and result.common_name != name: | |
print(result.name, "and", name, "does not match") | |
def main(): | |
with open("./world_universities_and_domains.json", "r") as ro_file: | |
src = json.load(ro_file) | |
if src is None: | |
return | |
check_iso_standard(src) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
should check not only name but also common_name in pycountry