worldfinder.get_countries

Functions

get_countries(city)

Return all unique countries that contain a given city.

Module Contents

worldfinder.get_countries.get_countries(city)[source]

Return all unique countries that contain a given city.

Parameters:

city (str) – The name of the city to search for.

Returns:

  • list of str – A list of unique countries (in their original case) that contain the specified city. The list will be deduplicated.

  • Raises

  • ——-

  • TypeError – If city input is not a string.

  • ValueError – If city input contains an empty string OR If city input is not a valid city

Examples

>>> get_countries("London")
["Canada", "United Kingdom", "United States"]