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
def get_latitute_and_longitude(): """ Imports capitals and shows their latitute and longitude ---format---- { COUNTRY : ["Capital", [latitude, longitude]] } """ lat_long_capitales = {} for pays, capitale in capitals.items(): lat_long = CountryInfo(pays) try: lat_long = lat_long.capital_latlng() except: lat_long = "erreur" lat_long_capitales[pays] = [capitale, lat_long] return lat_long_capitales
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:') for states in country_states: print(states, end=', ') about_country = country.wiki() country_map = country.capital_latlng() map = folium.Map(location=(country_map)) print( f'\n\nCheck your directory for the map of {user}, named: (mylocation.html)' ) map.save("mylocation.html") about_country = country.wiki() data = about_country qr = qrcode.QRCode(version=1, box_size=15, border=5) qr.add_data(data) qr.make(fit=True) img = qr.make_image(fill_color='black', back_color='white') print( f'\nCheck your directory for the qr code containing the information of {user}, named: (about_country.png)'