예제 #1
0
def country_info(country_name):
    d = []
    country = CountryInfo(country_name)
    d.append(["name", country.name().capitalize()])
    d.append(["capital", country.capital().capitalize()])
    d.append(["region", country.region().capitalize()])
    d.append(["currency", country.currencies()])
    d.append(["area", country.area()])
    d.append(["population", country.population()])
    d.append(["languages", country.languages()])
    d.append(["borders", country.borders()])
    d.append(["calling code", country.calling_codes()])
    d.append(["lat/long", country.capital_latlng()])
    d.append(["code", country.iso(2)])
    return d
예제 #2
0
    answer = choices[index]

    for x in range(options[category_index]):
        country_choice = CountryInfo(country_pool[x])

        if category == "area":
            print('(' + choices[x] + ') ' + str(country_choice.area()) +
                  " sq kilometers")

        elif category == "subregion":
            print('(' + choices[x] + ') ' + subregion_pool[x])

        elif category == "calling code":
            print('(' + choices[x] + ') ' +
                  str(country_choice.calling_codes()[0]))

        elif category == "population":
            print('(' + choices[x] + ') ' + str(country_choice.population()))

        elif category == "capital":
            print('(' + choices[x] + ') ' + country_choice.capital())

        elif category == "currency":
            print('(' + choices[x] + ') ' + currencies_pool[x])

        elif category == "latitude":
            print('(' + choices[x] + ') ' + str(country_choice.latlng()[0]))

        elif category == "longitude":
            print('(' + choices[x] + ') ' + str(country_choice.latlng()[1]))
예제 #3
0
data1 = country.alt_spellings()
print(data1)

data2 = country.capital()
print(data2)

data3 = country.currencies()
print(data3)

data4 = country.languages()
print(data4)

data5 = country.timezones()
print(data5)

data6 = country.area()
print(data6)

data7 = country.borders()
print(data7)

data8 = country.calling_codes()
print(data8)

data9 = country.wiki()
print(data9)

data10 = country.info()
for x, y in data10.items():
    print(f'{x} --> {y}')
예제 #4
0
    print(languages, end=', ')

country_timezone = country.timezones()
print('\n\nTime-Zone:')
for timezones in country_timezone:
    print(timezones, end=', ')

country_area = country.area()
print(f'\n\nCountry Area:\n{country_area}')

country_borders = country.borders()
print('\nBorders:')
for border in country_borders:
    print(border, end=', ')

calling_codes = country.calling_codes()
print('\n\nCall Code:')
for call_code in calling_codes:
    print(call_code)

country_region = country.region()
print(f'\nRegion:\n{country_region}')

sub_region = country.subregion()
print(f'\nSub-Region:\n{sub_region}')

country_population = country.population()
print(f'\nPopulation:\n{country_population}')

country_states = country.provinces()
print('\nStates/Provinces:')