How to use the countrynames.mappings.mappings function in countrynames

To help you get started, we’ve selected a few countrynames examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github alephdata / countrynames / countrynames / __init__.py View on Github external
def to_code_3(country_name, fuzzy=False):
    """Given a human name for a country, return a three letter code.

    Arguments:
        ``fuzzy``: Try fuzzy matching based on Levenshtein distance.
    """
    code = to_code(country_name, fuzzy=fuzzy)
    if code and len(code) > 2:
        return code
    elif code is None:
        return code
    else:
        return mappings[code]

countrynames

A library to map country names to ISO codes.

MIT
Latest version published 10 months ago

Package Health Score

62 / 100
Full package analysis

Similar packages