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

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

    # 如果没有找到对应国家,则返回None:
    return None
示例#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])
示例#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"))
示例#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))
示例#12
0
def get_country_code(country_name):
    for code, name in COUNTRIES.items():
        if name == country_name:
            return code
        return None
示例#13
0
def treat_unnamed_code(codes):
    x = {}
    for code, name in COUNTRIES.items():
        if code not in codes:
            x[code] = name
    return x