pycountry
pycountry copied to clipboard
Find subdivision within specific country
Adds functionality to find subdivisions within a country. The return value of pycountry.subdivisions.get(country=<country>)
is a dict
mapping a lowercased subdivision name to the subdivision object. This will solve the problem of not being able to lookup ambiguous subdivisions if a subdivision exists in multiple countries.
Any news on that ?
Otherwise, it would have been great to have a search_fuzzy
method for subdivisions, ideally with an optional country_code
parameter
Thanks. Right, I agree with the fuzzy search for other use cases. However, in this specific case I think it would be better to allow specifying multiple options in the subdivision.get() call instead of using a nested structure. I'm also not conviced about the lowercasing and then using a dict access.
ideally with an optional
country_code
parameter
I suggested that in #232