示例#1
0
def get_country_code(country_name):
    """根据指定的国家, 返回Pygal使用的两个字母的国别码"""
    for code, name in COUNTRIES.items():
        if name == country_name:
            return code
    # 如果没有 返回none
    return None
示例#2
0
def get_country_name(country_name):
    """returns for distinct country its 2-latters code for Pygal"""
    for code, name in COUNTRIES.items():
        if name == country_name:
            return code
    if country_name == 'Yemen, Rep.':
        return 'ye'
    if country_name == 'Vietnam':
        return 'vn'
    if country_name == 'Tonga':
        return 'to'
    if country_name == 'Venezuela, RB':
        return 've'
    if country_name == 'Egypt, Arab Rep.':
        return 'eg'
    if country_name == 'Macedonia, FYR':
        return 'mk'
    if country_name == 'Samoa':
        return 'sm'
    if country_name == 'Qatar':
        return 'qa'
    if country_name == 'Tanzania':
        return 'tz'
    if country_name == 'Korea, Dem. Rep.':
        return 'kp'
    if country_name == 'Moldova':
        return 'md'
    if country_name == 'Korea, Rep.':
        return 'kr'
    
        
    # if country wasnt finded, it would return None
    return None
示例#3
0
def get_country_name(country_name):
    """returns for distinct country its 2-latters code for Pygal"""
    for code, name in COUNTRIES.items():
        if name == country_name:
            return code
    # if country wasnt finded, it would return None
    return None
示例#4
0
def get_country_code(country_name):
    for code, name in COUNTRIES.items():
        if name == country_name:
            return code
        elif country_name == 'Yemen, Rep.':
            return 'ye'
    return None
示例#5
0
def get_country_code(country_name):
    """Devolver o código de duas letras do Pygal para um país, dado o seu nome """
    for code, name in COUNTRIES.items():
        if name == country_name:
            return code

    # Se o país não for encontrado retornar none
    return None


# print(get_country_code('Andorra'))
# print(get_country_code('United Arab Emirates'))
# print(get_country_code('Afghanistan'))
def get_country_code(country_name):
    """Return the Pygal 2-digit country code for the given country."""

    for code, name in COUNTRIES.items():
        if name == country_name:
            return code
    if country_name == 'Bolivia':
        return 'bo'
    elif country_name == 'Congo, Dem. Rep.':
        return 'cd'
    elif country_name == 'Dominica':
        return 'do'
    elif country_name == 'Gambia, The':
        return 'gm'
    elif country_name == 'Hong Kong SAR, China':
        return 'hk'
    elif country_name == 'Iran, Islamic Rep.':
        return 'ir'
    elif country_name == 'Korea, Dem. Rep.':
        return 'kp'
    elif country_name == 'Korea, Rep.':
        return 'kr'
    elif country_name == 'Kyrgyz Republic':
        return 'kg'
    elif country_name == 'Lao PDR':
        return 'la'
    elif country_name == 'Libya':
        return 'ly'
    elif country_name == 'Macedonia, FYR':
        return 'mk'
    elif country_name == 'Moldova':
        return 'md'
    elif country_name == 'Slovak Republic':
        return 'sk'
    elif country_name == 'Tanzania':
        return 'tz'
    elif country_name == 'Venezuela, RB':
        return 've'
    elif country_name == 'Vietnam':
        return 'vn'
    elif country_name == 'Yemen, Rep.':
        return 'ye'
    # If the country wasn't found, return None.
    return None


# print(get_country_code('Andorra'))
# print(get_country_code('United Arab Emirates'))
# print(get_country_code('Afghanistan'))
示例#7
0
def get_country_code(country_name):
    for code, name in COUNTRIES.items():
        if name == country_name:
            return code
    return None
示例#8
0
from pygal_maps_world.maps import COUNTRIES

for country_code in sorted(COUNTRIES.keys()):
    print(country_code, COUNTRIES[country_code])



示例#9
0
from pygal_maps_world.maps import COUNTRIES

for code, name in COUNTRIES.items():
    print(code, name)
示例#10
0
def get_country_code(country_name):
    """根据指定的国家, 返回国别码"""
    for code, name in COUNTRIES.items():
        if country_name == name:
            return code
    return None