Welcome to CountryFlag’s Documentation!

PyPI version Code style: black MIT License

CountryFlag is a Python package for converting country names to emoji flags and vice versa.

Motivation

The idea was to build a simple command to get the corresponding emoji flag starting from a country name.

Features

  • Convert country names to emoji flags

  • Support for reverse lookup (flag to country name)

  • Support for region/continent grouping

  • Multiple output formats (text, JSON, CSV)

  • Fuzzy matching for country names

  • Interactive CLI mode with autocompletion

  • Asynchronous and parallel processing

Installation

pip install countryflag

Quick Start

import countryflag

# Convert country names to emoji flags
countries = ['Germany', 'BE', 'United States of America', 'Japan']
flags = countryflag.getflag(countries)
print(flags)  # 🇩🇪 🇧🇪 🇺🇸 🇯🇵

# Command line usage
# countryflag Germany BE Spain 'United States of America'

Indices and tables