pycountry icon indicating copy to clipboard operation
pycountry copied to clipboard

Find subdivision within specific country

Open mmaroli opened this issue 4 years ago • 3 comments

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.

mmaroli avatar Dec 18 '20 00:12 mmaroli

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

Paul-DS avatar Feb 23 '22 16:02 Paul-DS

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.

ctheune avatar Mar 06 '22 09:03 ctheune

ideally with an optional country_code parameter

I suggested that in #232

cuducos avatar Jun 14 '24 17:06 cuducos