Ejemplo n.º 1
0
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 the country wasn't found, return None.
    return None
Ejemplo n.º 2
0
def get_country_code(country_name):
	"""根据指定的国家,返回Pygal使用的两个字母的国别码"""
	for code, name in COUNTRIES.items():
		if name == country_name:
			return code
	#如果没有找到指定的国家,就返回None
	return None
Ejemplo n.º 3
0
def get_country_code(country_name):
    """根据指定的国家, 返回国家代码"""
    for code, name in COUNTRIES.items():
        if name == country_name:
            return code
    # 如果没有找到指定的国家, 就返回 None
    return None
Ejemplo n.º 4
0
def get_country_code(country_name):
    """根据指定的国家,返回pygal使用两个字母的国别码"""
    for code, name in COUNTRIES.items():
        if name == country_name or name == country_name.title():
            return code
    #如果没有找到指定的国家,返回NONE
    return None
Ejemplo n.º 5
0
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 the country wasn't found, return None.
    return None
Ejemplo n.º 6
0
def get_country_code(country_name):
    """根据指定的国家, 返回国家代码"""
    for code, name in COUNTRIES.items():
        if name == country_name:
            return code
    # 如果没有找到指定的国家, 就返回 None
    return None
Ejemplo n.º 7
0
def get_country_code(country_name):
    """根据指定的国家名,返回Pygal使用的两个字母的国别码"""
    for code, name in COUNTRIES.items():
        if name == country_name:
            # 如果字典中存在指定的国家名,则返回其国别码,程序结束
            return code
    # 如果没有找到指定的国家,就返回None,程序结束
    return None
Ejemplo n.º 8
0
def get_country_code(country_name):
    """根据指定的国家,返回对应的国别码"""

    for code, name in COUNTRIES.items():
        if name == country_name:
            return code

    # 如果没有找到对应国家,则返回None:
    return None
Ejemplo n.º 9
0
def get_country_code(country_name):
    """根据指定的国家返回pygal使用的两个字母的国别号"""

    for code,name in COUNTRIES.items():
        if name == country_name:
            return code
    #如果没有找到指定的国家就返回none
    return None

    ##    print(country_code,COUNTRIES[country_code])
Ejemplo n.º 10
0
def get_country_code(country_name):
    """根据国家返回国别码"""
    for code, name in COUNTRIES.items():
        if name == country_name:
            return code

    return None


# print(get_country_code("Andorra"))
Ejemplo n.º 11
0
def get_country_code(country_name):
	"""根据指定的国家,返回Pygal使用的两个字母的国别码"""
	for code, name in COUNTRIES.items():
		if name == country_name:
			return code

	#如果没有找到指定的国家,就返回None
		elif country_name not in COUNTRIES.values():
			lost_country.add(country_name)

	print(len(lost_country))
Ejemplo n.º 12
0
def get_country_code(country_name):
    for code, name in COUNTRIES.items():
        if name == country_name:
            return code
        return None
Ejemplo n.º 13
0
def treat_unnamed_code(codes):
    x = {}
    for code, name in COUNTRIES.items():
        if code not in codes:
            x[code] = name
    return x