pycountries package
Submodules
pycountries.countries module
- class pycountries.countries.Country[source]
Bases:
EnumCountry Enum, a comprehensive collection that incorporates essential identifiers according to the ISO 3166-1 standard. It encompasses the ISO 3166-1 Alpha-2 code, which consists of two-letter country codes, the ISO 3166-1 Alpha-3 code, comprising three-letter country codes, and the ISO 3166-1 numeric code, which provides a three-digit numerical representation for each country.
Additionally, the Country Enum includes the full country names corresponding to these codes, offering a complete reference for identifying and categorizing countries worldwide.
- AD = 'AD'
- AE = 'AE'
- AF = 'AF'
- AG = 'AG'
- AI = 'AI'
- AL = 'AL'
- AM = 'AM'
- AO = 'AO'
- AQ = 'AQ'
- AR = 'AR'
- AS = 'AS'
- AT = 'AT'
- AU = 'AU'
- AW = 'AW'
- AX = 'AX'
- AZ = 'AZ'
- BA = 'BA'
- BB = 'BB'
- BD = 'BD'
- BE = 'BE'
- BF = 'BF'
- BG = 'BG'
- BH = 'BH'
- BI = 'BI'
- BJ = 'BJ'
- BL = 'BL'
- BM = 'BM'
- BN = 'BN'
- BO = 'BO'
- BQ = 'BQ'
- BR = 'BR'
- BS = 'BS'
- BT = 'BT'
- BV = 'BV'
- BW = 'BW'
- BY = 'BY'
- BZ = 'BZ'
- CA = 'CA'
- CC = 'CC'
- CD = 'CD'
- CF = 'CF'
- CG = 'CG'
- CH = 'CH'
- CI = 'CI'
- CK = 'CK'
- CL = 'CL'
- CM = 'CM'
- CN = 'CN'
- CO = 'CO'
- CR = 'CR'
- CU = 'CU'
- CV = 'CV'
- CW = 'CW'
- CX = 'CX'
- CY = 'CY'
- CZ = 'CZ'
- DE = 'DE'
- DJ = 'DJ'
- DK = 'DK'
- DM = 'DM'
- DO = 'DO'
- DZ = 'DZ'
- EC = 'EC'
- EE = 'EE'
- EG = 'EG'
- EH = 'EH'
- ER = 'ER'
- ES = 'ES'
- ET = 'ET'
- FI = 'FI'
- FJ = 'FJ'
- FK = 'FK'
- FM = 'FM'
- FO = 'FO'
- FR = 'FR'
- GA = 'GA'
- GB = 'GB'
- GD = 'GD'
- GE = 'GE'
- GF = 'GF'
- GG = 'GG'
- GH = 'GH'
- GI = 'GI'
- GL = 'GL'
- GM = 'GM'
- GN = 'GN'
- GP = 'GP'
- GQ = 'GQ'
- GR = 'GR'
- GS = 'GS'
- GT = 'GT'
- GU = 'GU'
- GW = 'GW'
- GY = 'GY'
- HK = 'HK'
- HM = 'HM'
- HN = 'HN'
- HR = 'HR'
- HT = 'HT'
- HU = 'HU'
- ID = 'ID'
- IE = 'IE'
- IL = 'IL'
- IM = 'IM'
- IN = 'IN'
- IO = 'IO'
- IQ = 'IQ'
- IR = 'IR'
- IS = 'IS'
- IT = 'IT'
- JE = 'JE'
- JM = 'JM'
- JO = 'JO'
- JP = 'JP'
- KE = 'KE'
- KG = 'KG'
- KH = 'KH'
- KI = 'KI'
- KM = 'KM'
- KN = 'KN'
- KP = 'KP'
- KR = 'KR'
- KW = 'KW'
- KY = 'KY'
- KZ = 'KZ'
- LA = 'LA'
- LB = 'LB'
- LC = 'LC'
- LI = 'LI'
- LK = 'LK'
- LR = 'LR'
- LS = 'LS'
- LT = 'LT'
- LU = 'LU'
- LV = 'LV'
- LY = 'LY'
- MA = 'MA'
- MC = 'MC'
- MD = 'MD'
- ME = 'ME'
- MF = 'MF'
- MG = 'MG'
- MH = 'MH'
- MK = 'MK'
- ML = 'ML'
- MM = 'MM'
- MN = 'MN'
- MO = 'MO'
- MP = 'MP'
- MQ = 'MQ'
- MR = 'MR'
- MS = 'MS'
- MT = 'MT'
- MU = 'MU'
- MV = 'MV'
- MW = 'MW'
- MX = 'MX'
- MY = 'MY'
- MZ = 'MZ'
- NA = 'NA'
- NC = 'NC'
- NE = 'NE'
- NF = 'NF'
- NG = 'NG'
- NI = 'NI'
- NL = 'NL'
- NO = 'NO'
- NP = 'NP'
- NR = 'NR'
- NU = 'NU'
- NZ = 'NZ'
- OM = 'OM'
- PA = 'PA'
- PE = 'PE'
- PF = 'PF'
- PG = 'PG'
- PH = 'PH'
- PK = 'PK'
- PL = 'PL'
- PM = 'PM'
- PN = 'PN'
- PR = 'PR'
- PS = 'PS'
- PT = 'PT'
- PW = 'PW'
- PY = 'PY'
- QA = 'QA'
- RE = 'RE'
- RO = 'RO'
- RS = 'RS'
- RU = 'RU'
- RW = 'RW'
- SA = 'SA'
- SB = 'SB'
- SC = 'SC'
- SD = 'SD'
- SE = 'SE'
- SG = 'SG'
- SH = 'SH'
- SI = 'SI'
- SJ = 'SJ'
- SK = 'SK'
- SL = 'SL'
- SM = 'SM'
- SN = 'SN'
- SO = 'SO'
- SR = 'SR'
- SS = 'SS'
- ST = 'ST'
- SV = 'SV'
- SX = 'SX'
- SY = 'SY'
- SZ = 'SZ'
- TC = 'TC'
- TD = 'TD'
- TF = 'TF'
- TG = 'TG'
- TH = 'TH'
- TJ = 'TJ'
- TK = 'TK'
- TL = 'TL'
- TM = 'TM'
- TN = 'TN'
- TO = 'TO'
- TR = 'TR'
- TT = 'TT'
- TV = 'TV'
- TW = 'TW'
- TZ = 'TZ'
- UA = 'UA'
- UG = 'UG'
- UM = 'UM'
- US = 'US'
- UY = 'UY'
- UZ = 'UZ'
- VA = 'VA'
- VC = 'VC'
- VE = 'VE'
- VG = 'VG'
- VI = 'VI'
- VN = 'VN'
- VU = 'VU'
- WF = 'WF'
- WS = 'WS'
- YE = 'YE'
- YT = 'YT'
- ZA = 'ZA'
- ZM = 'ZM'
- ZW = 'ZW'
- property alpha_2: str
This code is used as part of domain names, vehicle registration plates, and in international transactions, among other purposes.
- Returns:
ISO 3166-1 Alpha 2 code.
- property alpha_3: str
This code is commonly used in various international contexts, including identifying countries in internet domains, representing countries in airline ticketing, and facilitating international trade.
- Returns:
ISO 3166-1 Alpha 3 code.
- property name: str
Unofficial country name, known as shorten country name.
- Returns:
ISO 3166 name.
- property numeric
This code is used in various contexts where numeric representations are preferred over alphanumeric ones, such as in databases or systems where numerical identifiers are easier to work with.
- Returns:
ISO 3166-1 numeric code.
- property official_name: str
Official country name.
- Returns:
World Factbook official state name.
- property unit: CountryUnit
Returns:
pycountries.countries.CountryUnit.
- property value
Returns: ISO 3166-1 Alpha 2 code.
- class pycountries.countries.CountryUnit[source]
Bases:
UnitBase- alpha_2: str
- alpha_3: str
- model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[Dict[str, FieldInfo]] = {'alpha_2': FieldInfo(annotation=str, required=True, description='A two-letter country code assigned to each country or territory in the ISO 3166-1 standard. These codes are used as part of domain names, vehicle registration plates, and in international transactions, among other purposes.', examples=['US', 'MT', 'RU'], metadata=[MinLen(min_length=2), MaxLen(max_length=2)]), 'alpha_3': FieldInfo(annotation=str, required=True, description='A three-letter country code assigned to each country or territory in the ISO 3166-1 standard. These codes are commonly used in various international contexts, including identifying countries in internet domains, representing countries in airline ticketing, and facilitating international trade.', examples=['USA', 'MLT', 'RUS'], metadata=[MinLen(min_length=3), MaxLen(max_length=3)]), 'name': FieldInfo(annotation=str, required=True, description='Country shorten name.', examples=['United States', 'Malta', 'Russian Federation']), 'numeric': FieldInfo(annotation=str, required=True, description='A three-digit numeric code assigned to each country or territory in the ISO 3166-1 standard. These codes are used in various contexts where numeric representations are preferred over alphanumeric ones, such as in databases or systems where numerical identifiers are easier to work with.', examples=['840', '470', '643'], metadata=[MinLen(min_length=3), MaxLen(max_length=3)]), 'official_name': FieldInfo(annotation=str, required=True, description='Official country name,', examples=['United States of America', 'Republic of Malta', 'Russian Federation'])}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.
This replaces Model.__fields__ from Pydantic V1.
- name: str
- numeric: str
- official_name: str
pycountries.currencies module
- exception pycountries.currencies.AmountSpecialValuesNotAllowedError[source]
Bases:
BaseCurrencyErrorAmount Special Values Not Allowed Error.
- class pycountries.currencies.Currency[source]
Bases:
EnumThe Currency Enum is a comprehensive collection designed to facilitate currency handling in software applications. It encompasses the ISO 4217 standard, which defines alphabetic and numeric codes for currencies, along with their corresponding full names.
This Enum provides developers with a structured and standardized way to represent and manage currencies. Whether for financial transactions, currency conversion, or reporting purposes, the Currency Enum offers a reliable reference for accurately identifying and working with currencies across diverse software environments.
- AED = 'AED'
- AFN = 'AFN'
- ALL = 'ALL'
- AMD = 'AMD'
- ANG = 'ANG'
- AOA = 'AOA'
- ARS = 'ARS'
- AUD = 'AUD'
- AWG = 'AWG'
- AZN = 'AZN'
- BAM = 'BAM'
- BBD = 'BBD'
- BDT = 'BDT'
- BGN = 'BGN'
- BHD = 'BHD'
- BIF = 'BIF'
- BMD = 'BMD'
- BND = 'BND'
- BOB = 'BOB'
- BOV = 'BOV'
- BRL = 'BRL'
- BSD = 'BSD'
- BTN = 'BTN'
- BWP = 'BWP'
- BYN = 'BYN'
- BZD = 'BZD'
- CAD = 'CAD'
- CDF = 'CDF'
- CHE = 'CHE'
- CHF = 'CHF'
- CHW = 'CHW'
- CLF = 'CLF'
- CLP = 'CLP'
- CNY = 'CNY'
- COP = 'COP'
- COU = 'COU'
- CRC = 'CRC'
- CUC = 'CUC'
- CUP = 'CUP'
- CVE = 'CVE'
- CZK = 'CZK'
- DJF = 'DJF'
- DKK = 'DKK'
- DOP = 'DOP'
- DZD = 'DZD'
- EGP = 'EGP'
- ERN = 'ERN'
- ETB = 'ETB'
- EUR = 'EUR'
- FJD = 'FJD'
- FKP = 'FKP'
- GBP = 'GBP'
- GEL = 'GEL'
- GHS = 'GHS'
- GIP = 'GIP'
- GMD = 'GMD'
- GNF = 'GNF'
- GTQ = 'GTQ'
- GYD = 'GYD'
- HKD = 'HKD'
- HNL = 'HNL'
- HRK = 'HRK'
- HTG = 'HTG'
- HUF = 'HUF'
- IDR = 'IDR'
- ILS = 'ILS'
- INR = 'INR'
- IQD = 'IQD'
- IRR = 'IRR'
- ISK = 'ISK'
- JMD = 'JMD'
- JOD = 'JOD'
- JPY = 'JPY'
- KES = 'KES'
- KGS = 'KGS'
- KHR = 'KHR'
- KMF = 'KMF'
- KPW = 'KPW'
- KRW = 'KRW'
- KWD = 'KWD'
- KYD = 'KYD'
- KZT = 'KZT'
- LAK = 'LAK'
- LBP = 'LBP'
- LKR = 'LKR'
- LRD = 'LRD'
- LSL = 'LSL'
- LYD = 'LYD'
- MAD = 'MAD'
- MDL = 'MDL'
- MGA = 'MGA'
- MKD = 'MKD'
- MMK = 'MMK'
- MNT = 'MNT'
- MOP = 'MOP'
- MRU = 'MRU'
- MUR = 'MUR'
- MVR = 'MVR'
- MWK = 'MWK'
- MXN = 'MXN'
- MXV = 'MXV'
- MYR = 'MYR'
- MZN = 'MZN'
- NAD = 'NAD'
- NGN = 'NGN'
- NIO = 'NIO'
- NOK = 'NOK'
- NPR = 'NPR'
- NZD = 'NZD'
- OMR = 'OMR'
- PAB = 'PAB'
- PEN = 'PEN'
- PGK = 'PGK'
- PHP = 'PHP'
- PKR = 'PKR'
- PLN = 'PLN'
- PYG = 'PYG'
- QAR = 'QAR'
- RON = 'RON'
- RSD = 'RSD'
- RUB = 'RUB'
- RWF = 'RWF'
- SAR = 'SAR'
- SBD = 'SBD'
- SCR = 'SCR'
- SDG = 'SDG'
- SEK = 'SEK'
- SGD = 'SGD'
- SHP = 'SHP'
- SLE = 'SLE'
- SLL = 'SLL'
- SOS = 'SOS'
- SRD = 'SRD'
- SSP = 'SSP'
- STN = 'STN'
- SVC = 'SVC'
- SYP = 'SYP'
- SZL = 'SZL'
- THB = 'THB'
- TJS = 'TJS'
- TMT = 'TMT'
- TND = 'TND'
- TOP = 'TOP'
- TRY = 'TRY'
- TTD = 'TTD'
- TWD = 'TWD'
- TZS = 'TZS'
- UAH = 'UAH'
- UGX = 'UGX'
- USD = 'USD'
- USN = 'USN'
- UYI = 'UYI'
- UYU = 'UYU'
- UYW = 'UYW'
- UZS = 'UZS'
- VED = 'VED'
- VES = 'VES'
- VND = 'VND'
- VUV = 'VUV'
- WST = 'WST'
- XAF = 'XAF'
- XAG = 'XAG'
- XAU = 'XAU'
- XBA = 'XBA'
- XBB = 'XBB'
- XBC = 'XBC'
- XBD = 'XBD'
- XCD = 'XCD'
- XDR = 'XDR'
- XOF = 'XOF'
- XPD = 'XPD'
- XPF = 'XPF'
- XPT = 'XPT'
- XSU = 'XSU'
- XTS = 'XTS'
- XUA = 'XUA'
- XXX = 'XXX'
- YER = 'YER'
- ZAR = 'ZAR'
- ZMW = 'ZMW'
- ZWL = 'ZWL'
- property alpha_3: str
A three-letter alphabetic code. This alphabetic code is used internationally to represent currencies in financial transactions and data.
- Returns:
ISO 4217 code.
- clean_amount(amount, /, *, allow_zero=True)[source]
Cleans the given
amountbased on theself.unit.digitsdecimal precision.Keep in mind
amountmust be with fixed point, otherwise, the behaviour unpredictable. Why we support only fixed points? Because pydantic by default uses this representation and for payments always better to use fixed points.>>> from decimal import Decimal >>> from pycountries.currencies import ( >>> AmountSpecialValuesNotAllowedError, >>> NegativeAmountNotAllowedError, >>> WrongAmountDigitsNumberError, >>> WrongAmountTypeError, >>> ZeroAmountNotAllowedError, >>> ) >>> >>> correct_amount = Decimal("12") >>> Currency.BIF.clean_amount(correct_amount) # BIF has 0 digits >>> Decimal("12") >>> >>> wrong_special_amount = Decimal("inf") >>> try: >>> Currency.BIF.clean_amount(wrong_special_amount) >>> except AmountSpecialValuesNotAllowedError: >>> print("Amount Special Values Not Allowed") >>> >>> negative_amount = Decimal("-20.22") >>> try: >>> Currency.BIF.clean_amount(negative_amount) >>> except NegativeAmountNotAllowedError: >>> print("Negative Amount Not Allowed") >>> >>> wrong_digits_amount = Decimal("12.3") >>> try: >>> Currency.BIF.clean_amount(wrong_digits_amount) >>> except WrongAmountDigitsNumberError: >>> print("Wrong Amount Digits Number") >>> >>> wrong_type_amount = 22 >>> try: >>> Currency.BIF.clean_amount(wrong_type_amount) >>> except WrongAmountTypeError: >>> print("Wrong Amount Type") >>> >>> wrong_type_amount = Decimal("0.000") >>> try: >>> Currency.BIF.clean_amount(wrong_type_amount) >>> except ZeroAmountNotAllowedError: >>> print("Zero Amount Not Allowed") >>> >>> correct_amount_missing_digits = Decimal("12.3") >>> Currency.USD.clean_amount(correct_amount_missing_digits) # USD has 2 digits >>> Decimal("12.30")
- Parameters:
amount (decimal.Decimal) – The amount to clean. Please pass only fixed point representation.x
allow_zero (bool) – If False only non-zero values are allowed.
- Returns:
The cleaned amount with the appropriate precision.
- Return type:
decimal.Decimal
- Raises:
pycountries.WrongAmountTypeError – If
amounthas not allowed type.pycountries.NegativeAmountNotAllowedError – If
amountis negative.pycountries.ZeroAmountNotAllowedError – If
amountis zero whenallow_zerois False.pycountries.AmountSpecialValuesNotAllowedError – If
amountis infinite or NaN.pycountries.WrongAmountDigitsNumberError – If
amounthas more digites than currency can have.
- property digits: int
Maximum currency digits. The maximum currency digits for many major currencies like the US Dollar (USD), Euro (EUR), and British Pound Sterling (GBP) is 2, meaning that values are typically rounded to two decimal places. However, there are exceptions, such as the Kuwaiti Dinar (KWD), which has a maximum currency digits of 3.
- Returns:
ISO 4217 decimal.
- property name: str
The full currency name.
- Returns:
ISO 4217 name.
- property numeric: str
Numeric code. Preferred over alphabetic ones, such as in databases or systems where numeric identifiers are easier to work with.
- Returns:
ISO 4217 numeric.
- three_digits = [Currency.Bahraini Dinar, Currency.Jordanian Dinar, Currency.Kuwaiti Dinar, Currency.Rial Omani, Currency.Tunisian Dinar]
- two_digits = [Currency.UAE Dirham, Currency.Afghani, Currency.Lek, Currency.Armenian Dram, Currency.Netherlands Antillean Guilder, Currency.Kwanza, Currency.Argentine Peso, Currency.Australian Dollar, Currency.Aruban Florin, Currency.Azerbaijan Manat, Currency.Convertible Mark, Currency.Barbados Dollar, Currency.Taka, Currency.Bulgarian Lev, Currency.Bermudian Dollar, Currency.Brunei Dollar, Currency.Boliviano, Currency.Mvdol, Currency.Brazilian Real, Currency.Bahamian Dollar, Currency.Ngultrum, Currency.Pula, Currency.Belarusian Ruble, Currency.Belize Dollar, Currency.Canadian Dollar, Currency.Congolese Franc, Currency.WIR Euro, Currency.Swiss Franc, Currency.WIR Franc, Currency.Unidad de Fomento, Currency.Yuan Renminbi, Currency.Colombian Peso, Currency.Unidad de Valor Real, Currency.Costa Rican Colon, Currency.Peso Convertible, Currency.Cuban Peso, Currency.Cabo Verde Escudo, Currency.Czech Koruna, Currency.Danish Krone, Currency.Dominican Peso, Currency.Algerian Dinar, Currency.Egyptian Pound, Currency.Nakfa, Currency.Ethiopian Birr, Currency.Euro, Currency.Fiji Dollar, Currency.Falkland Islands Pound, Currency.Pound Sterling, Currency.Lari, Currency.Ghana Cedi, Currency.Gibraltar Pound, Currency.Dalasi, Currency.Quetzal, Currency.Guyana Dollar, Currency.Hong Kong Dollar, Currency.Lempira, Currency.Kuna, Currency.Gourde, Currency.Forint, Currency.Rupiah, Currency.New Israeli Sheqel, Currency.Indian Rupee, Currency.Iraqi Dinar, Currency.Iranian Rial, Currency.Iceland Krona, Currency.Jamaican Dollar, Currency.Kenyan Shilling, Currency.Som, Currency.Riel, Currency.North Korean Won, Currency.Cayman Islands Dollar, Currency.Tenge, Currency.Lao Kip, Currency.Lebanese Pound, Currency.Sri Lanka Rupee, Currency.Liberian Dollar, Currency.Loti, Currency.Libyan Dinar, Currency.Moroccan Dirham, Currency.Moldovan Leu, Currency.Denar, Currency.Kyat, Currency.Tugrik, Currency.Pataca, Currency.Ouguiya, Currency.Mauritius Rupee, Currency.Rufiyaa, Currency.Malawi Kwacha, Currency.Mexican Peso, Currency.Mexican Unidad de Inversion (UDI), Currency.Malaysian Ringgit, Currency.Mozambique Metical, Currency.Namibia Dollar, Currency.Naira, Currency.Cordoba Oro, Currency.Norwegian Krone, Currency.Nepalese Rupee, Currency.New Zealand Dollar, Currency.Balboa, Currency.Sol, Currency.Kina, Currency.Philippine Peso, Currency.Pakistan Rupee, Currency.Zloty, Currency.Qatari Rial, Currency.Romanian Leu, Currency.Serbian Dinar, Currency.Russian Ruble, Currency.Saudi Riyal, Currency.Solomon Islands Dollar, Currency.Seychelles Rupee, Currency.Sudanese Pound, Currency.Swedish Krona, Currency.Singapore Dollar, Currency.Saint Helena Pound, Currency.Leone, Currency.Leone, Currency.Somali Shilling, Currency.Surinam Dollar, Currency.South Sudanese Pound, Currency.Dobra, Currency.El Salvador Colon, Currency.Syrian Pound, Currency.Lilangeni, Currency.Baht, Currency.Somoni, Currency.Turkmenistan New Manat, Currency.Pa’anga, Currency.Turkish Lira, Currency.Trinidad and Tobago Dollar, Currency.New Taiwan Dollar, Currency.Tanzanian Shilling, Currency.Hryvnia, Currency.US Dollar, Currency.US Dollar (Next day), Currency.Uruguay Peso en Unidades Indexadas (UI), Currency.Peso Uruguayo, Currency.Unidad Previsional, Currency.Uzbekistan Sum, Currency.Bolívar Soberano, Currency.Bolívar Soberano, Currency.Tala, Currency.Silver, Currency.Gold, Currency.Bond Markets Unit European Composite Unit (EURCO), Currency.Bond Markets Unit European Monetary Unit (E.M.U.-6), Currency.Bond Markets Unit European Unit of Account 9 (E.U.A.-9), Currency.Bond Markets Unit European Unit of Account 17 (E.U.A.-17), Currency.East Caribbean Dollar, Currency.SDR (Special Drawing Right), Currency.Palladium, Currency.Platinum, Currency.Sucre, Currency.Codes specifically reserved for testing purposes, Currency.ADB Unit of Account, Currency.The codes assigned for transactions where no currency is involved, Currency.Yemeni Rial, Currency.Rand, Currency.Zambian Kwacha, Currency.Zimbabwe Dollar]
- property unit: CurrencyUnit
Returns:
pycountries.currencies.CurrencyUnit.
- property value: str
Returns: ISO 4217 code.
- zero_digits = [Currency.Burundi Franc, Currency.Chilean Peso, Currency.Djibouti Franc, Currency.Guinean Franc, Currency.Yen, Currency.Comorian Franc, Currency.Won, Currency.Malagasy Ariary, Currency.Guarani, Currency.Rwanda Franc, Currency.Uganda Shilling, Currency.Dong, Currency.Vatu, Currency.CFA Franc BEAC, Currency.CFA Franc BCEAO, Currency.CFP Franc]
- class pycountries.currencies.CurrencyUnit[source]
Bases:
UnitBase- alpha_3: str
- digits: int
- model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[Dict[str, FieldInfo]] = {'alpha_3': FieldInfo(annotation=str, required=True, description='A three-letter alphabetic code. This alphabetic code is used internationally to represent currency in financial transaction and data. It is standardized by the International Organization for Standardization (ISO) to facilitate consistency and clarity in financial communications.', examples=['USD', 'EUR', 'RUB'], metadata=[MinLen(min_length=3), MaxLen(max_length=3)]), 'digits': FieldInfo(annotation=int, required=False, default=2, description='The maximum number of decimal places that are typically used when dealing with a currency.', examples=['2', '2', '2']), 'name': FieldInfo(annotation=str, required=True, description='Official title of a currency', examples=['US Dollar', 'Euro', 'Russian Ruble']), 'numeric': FieldInfo(annotation=str, required=True, description='Numeric code. Used to represent currency in context where numerical representation is preferred over alphabetic ones, such as in databases or systems where numeric identifier is easier to work with.', examples=['840', '978', '643'], metadata=[MinLen(min_length=3), MaxLen(max_length=3)])}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.
This replaces Model.__fields__ from Pydantic V1.
- name: str
- numeric: str
- exception pycountries.currencies.NegativeAmountNotAllowedError[source]
Bases:
BaseCurrencyErrorNegative Amount Not Allowed Error
- exception pycountries.currencies.WrongAmountDigitsNumberError[source]
Bases:
BaseCurrencyErrorWrong Amount Digits Number Error.
- exception pycountries.currencies.WrongAmountTypeError[source]
Bases:
BaseCurrencyErrorWrong Amount Type Error
- exception pycountries.currencies.ZeroAmountNotAllowedError[source]
Bases:
BaseCurrencyErrorZero Amount Not Allowed Error
pycountries.languages module
- class pycountries.languages.Language[source]
Bases:
EnumThe Language Enum comprises the ISO 639 standard, encompassing both the two-letter Alpha-2 codes and the three-letter Alpha-3 codes. Additionally, certain languages may have alternative codes designated for bibliographic or terminology purposes.
- AAR = 'aar'
- ABK = 'abk'
- ACE = 'ace'
- ACH = 'ach'
- ADA = 'ada'
- ADY = 'ady'
- AFA = 'afa'
- AFH = 'afh'
- AFR = 'afr'
- AIN = 'ain'
- AKA = 'aka'
- AKK = 'akk'
- ALB = 'alb'
- ALE = 'ale'
- ALG = 'alg'
- ALT = 'alt'
- AMH = 'amh'
- ANG = 'ang'
- ANP = 'anp'
- APA = 'apa'
- ARA = 'ara'
- ARC = 'arc'
- ARG = 'arg'
- ARM = 'arm'
- ARN = 'arn'
- ARP = 'arp'
- ART = 'art'
- ARW = 'arw'
- ASM = 'asm'
- AST = 'ast'
- ATH = 'ath'
- AUS = 'aus'
- AVA = 'ava'
- AVE = 'ave'
- AWA = 'awa'
- AYM = 'aym'
- AZE = 'aze'
- BAD = 'bad'
- BAI = 'bai'
- BAK = 'bak'
- BAL = 'bal'
- BAM = 'bam'
- BAN = 'ban'
- BAQ = 'baq'
- BAS = 'bas'
- BAT = 'bat'
- BEJ = 'bej'
- BEL = 'bel'
- BEM = 'bem'
- BEN = 'ben'
- BER = 'ber'
- BHO = 'bho'
- BIH = 'bih'
- BIK = 'bik'
- BIN = 'bin'
- BIS = 'bis'
- BLA = 'bla'
- BNT = 'bnt'
- BOD = 'bod'
- BOS = 'bos'
- BRA = 'bra'
- BRE = 'bre'
- BTK = 'btk'
- BUA = 'bua'
- BUG = 'bug'
- BUL = 'bul'
- BUR = 'bur'
- BYN = 'byn'
- CAD = 'cad'
- CAI = 'cai'
- CAR = 'car'
- CAT = 'cat'
- CAU = 'cau'
- CEB = 'ceb'
- CEL = 'cel'
- CES = 'ces'
- CHA = 'cha'
- CHB = 'chb'
- CHE = 'che'
- CHG = 'chg'
- CHI = 'chi'
- CHK = 'chk'
- CHM = 'chm'
- CHN = 'chn'
- CHO = 'cho'
- CHP = 'chp'
- CHR = 'chr'
- CHU = 'chu'
- CHV = 'chv'
- CHY = 'chy'
- CMC = 'cmc'
- CNR = 'cnr'
- COP = 'cop'
- COR = 'cor'
- COS = 'cos'
- CPE = 'cpe'
- CPF = 'cpf'
- CPP = 'cpp'
- CRE = 'cre'
- CRH = 'crh'
- CRP = 'crp'
- CSB = 'csb'
- CUS = 'cus'
- CYM = 'cym'
- CZE = 'cze'
- DAK = 'dak'
- DAN = 'dan'
- DAR = 'dar'
- DAY = 'day'
- DEL = 'del'
- DEN = 'den'
- DEU = 'deu'
- DGR = 'dgr'
- DIN = 'din'
- DIV = 'div'
- DOI = 'doi'
- DRA = 'dra'
- DSB = 'dsb'
- DUA = 'dua'
- DUM = 'dum'
- DUT = 'dut'
- DYU = 'dyu'
- DZO = 'dzo'
- EFI = 'efi'
- EGY = 'egy'
- EKA = 'eka'
- ELL = 'ell'
- ELX = 'elx'
- ENG = 'eng'
- ENM = 'enm'
- EPO = 'epo'
- EST = 'est'
- EUS = 'eus'
- EWE = 'ewe'
- EWO = 'ewo'
- FAN = 'fan'
- FAO = 'fao'
- FAS = 'fas'
- FAT = 'fat'
- FIJ = 'fij'
- FIL = 'fil'
- FIN = 'fin'
- FIU = 'fiu'
- FON = 'fon'
- FRA = 'fra'
- FRE = 'fre'
- FRM = 'frm'
- FRO = 'fro'
- FRR = 'frr'
- FRS = 'frs'
- FRY = 'fry'
- FUL = 'ful'
- FUR = 'fur'
- GAA = 'gaa'
- GAY = 'gay'
- GBA = 'gba'
- GEM = 'gem'
- GEO = 'geo'
- GER = 'ger'
- GEZ = 'gez'
- GIL = 'gil'
- GLA = 'gla'
- GLE = 'gle'
- GLG = 'glg'
- GLV = 'glv'
- GMH = 'gmh'
- GOH = 'goh'
- GON = 'gon'
- GOR = 'gor'
- GOT = 'got'
- GRB = 'grb'
- GRC = 'grc'
- GRE = 'gre'
- GRN = 'grn'
- GSW = 'gsw'
- GUJ = 'guj'
- GWI = 'gwi'
- HAI = 'hai'
- HAT = 'hat'
- HAU = 'hau'
- HAW = 'haw'
- HEB = 'heb'
- HER = 'her'
- HIL = 'hil'
- HIM = 'him'
- HIN = 'hin'
- HIT = 'hit'
- HMN = 'hmn'
- HMO = 'hmo'
- HRV = 'hrv'
- HSB = 'hsb'
- HUN = 'hun'
- HUP = 'hup'
- HYE = 'hye'
- IBA = 'iba'
- IBO = 'ibo'
- ICE = 'ice'
- IDO = 'ido'
- III = 'iii'
- IJO = 'ijo'
- IKU = 'iku'
- ILE = 'ile'
- ILO = 'ilo'
- INA = 'ina'
- INC = 'inc'
- IND = 'ind'
- INE = 'ine'
- INH = 'inh'
- IPK = 'ipk'
- IRA = 'ira'
- IRO = 'iro'
- ISL = 'isl'
- ITA = 'ita'
- JAV = 'jav'
- JBO = 'jbo'
- JPN = 'jpn'
- JPR = 'jpr'
- JRB = 'jrb'
- KAA = 'kaa'
- KAB = 'kab'
- KAC = 'kac'
- KAL = 'kal'
- KAM = 'kam'
- KAN = 'kan'
- KAR = 'kar'
- KAS = 'kas'
- KAT = 'kat'
- KAU = 'kau'
- KAW = 'kaw'
- KAZ = 'kaz'
- KBD = 'kbd'
- KHA = 'kha'
- KHI = 'khi'
- KHM = 'khm'
- KHO = 'kho'
- KIK = 'kik'
- KIN = 'kin'
- KIR = 'kir'
- KMB = 'kmb'
- KOK = 'kok'
- KOM = 'kom'
- KON = 'kon'
- KOR = 'kor'
- KOS = 'kos'
- KPE = 'kpe'
- KRC = 'krc'
- KRL = 'krl'
- KRO = 'kro'
- KRU = 'kru'
- KUA = 'kua'
- KUM = 'kum'
- KUR = 'kur'
- KUT = 'kut'
- LAD = 'lad'
- LAH = 'lah'
- LAM = 'lam'
- LAO = 'lao'
- LAT = 'lat'
- LAV = 'lav'
- LEZ = 'lez'
- LIM = 'lim'
- LIN = 'lin'
- LIT = 'lit'
- LOL = 'lol'
- LOZ = 'loz'
- LTZ = 'ltz'
- LUA = 'lua'
- LUB = 'lub'
- LUG = 'lug'
- LUI = 'lui'
- LUN = 'lun'
- LUO = 'luo'
- LUS = 'lus'
- MAC = 'mac'
- MAD = 'mad'
- MAG = 'mag'
- MAH = 'mah'
- MAI = 'mai'
- MAK = 'mak'
- MAL = 'mal'
- MAN = 'man'
- MAO = 'mao'
- MAP = 'map'
- MAR = 'mar'
- MAS = 'mas'
- MAY = 'may'
- MDF = 'mdf'
- MDR = 'mdr'
- MEN = 'men'
- MGA = 'mga'
- MIC = 'mic'
- MIN = 'min'
- MIS = 'mis'
- MKD = 'mkd'
- MKH = 'mkh'
- MLG = 'mlg'
- MLT = 'mlt'
- MNC = 'mnc'
- MNI = 'mni'
- MNO = 'mno'
- MOH = 'moh'
- MON = 'mon'
- MOS = 'mos'
- MRI = 'mri'
- MSA = 'msa'
- MUL = 'mul'
- MUN = 'mun'
- MUS = 'mus'
- MWL = 'mwl'
- MWR = 'mwr'
- MYA = 'mya'
- MYN = 'myn'
- MYV = 'myv'
- NAH = 'nah'
- NAI = 'nai'
- NAP = 'nap'
- NAU = 'nau'
- NAV = 'nav'
- NBL = 'nbl'
- NDE = 'nde'
- NDO = 'ndo'
- NDS = 'nds'
- NEP = 'nep'
- NEW = 'new'
- NIA = 'nia'
- NIC = 'nic'
- NIU = 'niu'
- NLD = 'nld'
- NNO = 'nno'
- NOB = 'nob'
- NOG = 'nog'
- NON = 'non'
- NOR = 'nor'
- NQO = 'nqo'
- NSO = 'nso'
- NUB = 'nub'
- NWC = 'nwc'
- NYA = 'nya'
- NYM = 'nym'
- NYN = 'nyn'
- NYO = 'nyo'
- NZI = 'nzi'
- OCI = 'oci'
- OJI = 'oji'
- ORI = 'ori'
- ORM = 'orm'
- OSA = 'osa'
- OSS = 'oss'
- OTA = 'ota'
- OTO = 'oto'
- PAA = 'paa'
- PAG = 'pag'
- PAL = 'pal'
- PAM = 'pam'
- PAN = 'pan'
- PAP = 'pap'
- PAU = 'pau'
- PEO = 'peo'
- PER = 'per'
- PHI = 'phi'
- PHN = 'phn'
- PLI = 'pli'
- POL = 'pol'
- PON = 'pon'
- POR = 'por'
- PRA = 'pra'
- PRO = 'pro'
- PUS = 'pus'
- QUE = 'que'
- RAJ = 'raj'
- RAP = 'rap'
- RAR = 'rar'
- ROA = 'roa'
- ROH = 'roh'
- ROM = 'rom'
- RON = 'ron'
- RUM = 'rum'
- RUN = 'run'
- RUP = 'rup'
- RUS = 'rus'
- SAD = 'sad'
- SAG = 'sag'
- SAH = 'sah'
- SAI = 'sai'
- SAL = 'sal'
- SAM = 'sam'
- SAN = 'san'
- SAS = 'sas'
- SAT = 'sat'
- SCN = 'scn'
- SCO = 'sco'
- SEL = 'sel'
- SEM = 'sem'
- SGA = 'sga'
- SGN = 'sgn'
- SHN = 'shn'
- SID = 'sid'
- SIN = 'sin'
- SIO = 'sio'
- SIT = 'sit'
- SLA = 'sla'
- SLK = 'slk'
- SLO = 'slo'
- SLV = 'slv'
- SMA = 'sma'
- SME = 'sme'
- SMI = 'smi'
- SMJ = 'smj'
- SMN = 'smn'
- SMO = 'smo'
- SMS = 'sms'
- SNA = 'sna'
- SND = 'snd'
- SNK = 'snk'
- SOG = 'sog'
- SOM = 'som'
- SON = 'son'
- SOT = 'sot'
- SPA = 'spa'
- SQI = 'sqi'
- SRD = 'srd'
- SRN = 'srn'
- SRP = 'srp'
- SRR = 'srr'
- SSA = 'ssa'
- SSW = 'ssw'
- SUK = 'suk'
- SUN = 'sun'
- SUS = 'sus'
- SUX = 'sux'
- SWA = 'swa'
- SWE = 'swe'
- SYC = 'syc'
- SYR = 'syr'
- TAH = 'tah'
- TAI = 'tai'
- TAM = 'tam'
- TAT = 'tat'
- TEL = 'tel'
- TEM = 'tem'
- TER = 'ter'
- TET = 'tet'
- TGK = 'tgk'
- TGL = 'tgl'
- THA = 'tha'
- TIB = 'tib'
- TIG = 'tig'
- TIR = 'tir'
- TIV = 'tiv'
- TKL = 'tkl'
- TLH = 'tlh'
- TLI = 'tli'
- TMH = 'tmh'
- TOG = 'tog'
- TON = 'ton'
- TPI = 'tpi'
- TSI = 'tsi'
- TSN = 'tsn'
- TSO = 'tso'
- TUK = 'tuk'
- TUM = 'tum'
- TUP = 'tup'
- TUR = 'tur'
- TUT = 'tut'
- TVL = 'tvl'
- TWI = 'twi'
- TYV = 'tyv'
- UDM = 'udm'
- UGA = 'uga'
- UIG = 'uig'
- UKR = 'ukr'
- UMB = 'umb'
- UND = 'und'
- URD = 'urd'
- UZB = 'uzb'
- VAI = 'vai'
- VEN = 'ven'
- VIE = 'vie'
- VOL = 'vol'
- VOT = 'vot'
- WAK = 'wak'
- WAL = 'wal'
- WAR = 'war'
- WAS = 'was'
- WEL = 'wel'
- WEN = 'wen'
- WLN = 'wln'
- WOL = 'wol'
- XAL = 'xal'
- XHO = 'xho'
- YAO = 'yao'
- YAP = 'yap'
- YID = 'yid'
- YOR = 'yor'
- YPK = 'ypk'
- ZAP = 'zap'
- ZBL = 'zbl'
- ZEN = 'zen'
- ZGH = 'zgh'
- ZHA = 'zha'
- ZHO = 'zho'
- ZND = 'znd'
- ZUL = 'zul'
- ZUN = 'zun'
- ZXX = 'zxx'
- ZZA = 'zza'
- property alpha_2: str | None
Returns: ISO 639-1 Alpha 2 code. Can be
None.
- property alpha_3: str
Returns: ISO 639-2 Alpha 3 code.
- property bibliographic: str | None
Returns: ISO 639-2 Alpha 3 bibliographic code.
- property terminology: str
Returns: ISO 639-2 Alpha 3 terminology code.
- property unit: LanguageUnit
Returns:
pycountries.languages.LanguageUnit.
- property value: str
Returns: ISO 639-2 Alpha 3 code.
- class pycountries.languages.LanguageUnit[source]
Bases:
LanguageUnitBase- alpha_2: str | None
- bibliographic: str | None
- model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[Dict[str, FieldInfo]] = {'alpha_2': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='ISO 639-2 two-letter code to represent language.', examples=['en', 'ru'], metadata=[MinLen(min_length=2), MaxLen(max_length=2)]), 'alpha_3': FieldInfo(annotation=str, required=True, description='ISO 639-2 three-letter code to represent language.', examples=['eng', 'fra', 'rus'], metadata=[MinLen(min_length=3), MaxLen(max_length=3)]), 'bibliographic': FieldInfo(annotation=Union[str, NoneType], required=True, description='ISO 639-2 code designated specifically for bibliographic or library cataloging purposes. Bibliographic code is used primarily in library systems and databases to categorize and organize resources by language.', examples=[None, 'fre', None], metadata=[MinLen(min_length=3), MaxLen(max_length=3)]), 'name': FieldInfo(annotation=str, required=True, description='Official Language name.', examples=['English', 'French', 'Russian']), 'terminology': FieldInfo(annotation=str, required=True, description='ISO 639-2 code refers to specific language code designated for terminology or specialized vocabulary purposes.', examples=['eng', 'fra', 'rus'], metadata=[MinLen(min_length=3), MaxLen(max_length=3)])}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.
This replaces Model.__fields__ from Pydantic V1.
- class pycountries.languages.LanguageUnitBase[source]
Bases:
BaseModel- alpha_3: str
- model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[Dict[str, FieldInfo]] = {'alpha_3': FieldInfo(annotation=str, required=True, description='ISO 639-2 three-letter code to represent language.', examples=['eng', 'fra', 'rus'], metadata=[MinLen(min_length=3), MaxLen(max_length=3)]), 'name': FieldInfo(annotation=str, required=True, description='Official Language name.', examples=['English', 'French', 'Russian']), 'terminology': FieldInfo(annotation=str, required=True, description='ISO 639-2 code refers to specific language code designated for terminology or specialized vocabulary purposes.', examples=['eng', 'fra', 'rus'], metadata=[MinLen(min_length=3), MaxLen(max_length=3)])}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.
This replaces Model.__fields__ from Pydantic V1.
- name: str
- terminology: str
pycountries.macro_languages module
- class pycountries.macro_languages.MacroLanguage[source]
Bases:
Enum- AAE = 'sqi'
- AAO = 'ara'
- AAT = 'sqi'
- ABH = 'ara'
- ABV = 'ara'
- ACM = 'ara'
- ACQ = 'ara'
- ACW = 'ara'
- ACX = 'ara'
- ACY = 'ara'
- ADF = 'ara'
- AEB = 'ara'
- AEC = 'ara'
- AFB = 'ara'
- AII = 'syr'
- AJP = 'ara'
- AJT = 'jrb'
- AJU = 'jrb'
- ALN = 'sqi'
- ALS = 'sqi'
- APC = 'ara'
- APD = 'ara'
- ARB = 'ara'
- ARQ = 'ara'
- ARS = 'ara'
- ARY = 'ara'
- ARZ = 'ara'
- AUZ = 'ara'
- AVL = 'ara'
- AYC = 'aym'
- AYH = 'ara'
- AYL = 'ara'
- AYN = 'ara'
- AYP = 'ara'
- AYR = 'aym'
- AZB = 'aze'
- AZJ = 'aze'
- BBZ = 'ara'
- BCC = 'bal'
- BCL = 'bik'
- BDT = 'gba'
- BGN = 'bal'
- BGP = 'bal'
- BGQ = 'raj'
- BHK = 'bik'
- BHR = 'mlg'
- BJN = 'msa'
- BJQ = 'mlg'
- BLN = 'bik'
- BLU = 'hmn'
- BMM = 'mlg'
- BOS = 'hbs'
- BTJ = 'msa'
- BTO = 'bik'
- BVE = 'msa'
- BVU = 'msa'
- BXK = 'luy'
- BXM = 'bua'
- BXR = 'bua'
- BXU = 'bua'
- BZC = 'mlg'
- CCX = 'zha'
- CCY = 'zha'
- CDO = 'zho'
- CIW = 'oji'
- CJY = 'zho'
- CKB = 'kur'
- CLD = 'syr'
- CLS = 'san'
- CMN = 'zho'
- CNP = 'zho'
- CNR = 'hbs'
- COA = 'msa'
- CPX = 'zho'
- CQD = 'hmn'
- CQU = 'que'
- CRJ = 'cre'
- CRK = 'cre'
- CRL = 'cre'
- CRM = 'cre'
- CSP = 'zho'
- CSW = 'cre'
- CTS = 'bik'
- CWD = 'cre'
- CZH = 'zho'
- CZO = 'zho'
- DGO = 'doi'
- DHD = 'mwr'
- DIB = 'din'
- DIK = 'din'
- DIP = 'din'
- DIQ = 'zza'
- DIW = 'din'
- DKS = 'din'
- DTY = 'nep'
- DUP = 'msa'
- EBK = 'bnc'
- EKK = 'est'
- EMK = 'man'
- ENB = 'kln'
- ESG = 'gon'
- ESI = 'ipk'
- ESK = 'ipk'
- EYO = 'kln'
- FAT = 'aka'
- FBL = 'bik'
- FFM = 'ful'
- FUB = 'ful'
- FUC = 'ful'
- FUE = 'ful'
- FUF = 'ful'
- FUH = 'ful'
- FUI = 'ful'
- FUQ = 'ful'
- FUV = 'ful'
- GAN = 'zho'
- GAX = 'orm'
- GAZ = 'orm'
- GBO = 'grb'
- GBP = 'gba'
- GBQ = 'gba'
- GDA = 'raj'
- GEC = 'grb'
- GGO = 'gon'
- GJU = 'raj'
- GKP = 'kpe'
- GMM = 'gba'
- GNO = 'gon'
- GNW = 'grn'
- GOM = 'kok'
- GRJ = 'grb'
- GRV = 'grb'
- GRY = 'grb'
- GSO = 'gba'
- GUG = 'grn'
- GUI = 'grn'
- GUN = 'grn'
- GYA = 'gba'
- HAE = 'orm'
- HAK = 'zho'
- HAX = 'hai'
- HDN = 'hai'
- HEA = 'hmn'
- HJI = 'msa'
- HMA = 'hmn'
- HMC = 'hmn'
- HMD = 'hmn'
- HME = 'hmn'
- HMG = 'hmn'
- HMH = 'hmn'
- HMI = 'hmn'
- HMJ = 'hmn'
- HML = 'hmn'
- HMM = 'hmn'
- HMP = 'hmn'
- HMQ = 'hmn'
- HMS = 'hmn'
- HMW = 'hmn'
- HMY = 'hmn'
- HMZ = 'hmn'
- HND = 'lah'
- HNJ = 'hmn'
- HNO = 'lah'
- HOJ = 'raj'
- HRM = 'hmn'
- HRV = 'hbs'
- HSN = 'zho'
- HUJ = 'hmn'
- IDA = 'luy'
- IKE = 'iku'
- IKT = 'iku'
- IND = 'msa'
- JAK = 'msa'
- JAT = 'lah'
- JAX = 'msa'
- JYE = 'jrb'
- KBY = 'kau'
- KHK = 'mon'
- KIU = 'zza'
- KMR = 'kur'
- KNC = 'kau'
- KNG = 'kon'
- KNN = 'kok'
- KOI = 'kom'
- KPV = 'kom'
- KRT = 'kau'
- KVB = 'msa'
- KVR = 'msa'
- KWY = 'kon'
- KXD = 'msa'
- LBK = 'bnc'
- LBL = 'bik'
- LCE = 'msa'
- LCF = 'msa'
- LDI = 'kon'
- LIW = 'msa'
- LKB = 'luy'
- LKO = 'luy'
- LKS = 'luy'
- LRI = 'luy'
- LRM = 'luy'
- LSM = 'luy'
- LTG = 'lav'
- LTO = 'luy'
- LTS = 'luy'
- LVS = 'lav'
- LWG = 'luy'
- LZH = 'zho'
- MAX = 'msa'
- MDO = 'gba'
- MEO = 'msa'
- MFA = 'msa'
- MFB = 'msa'
- MHR = 'chm'
- MIN = 'msa'
- MKU = 'man'
- MLQ = 'man'
- MLY = 'msa'
- MMR = 'hmn'
- MNK = 'man'
- MNP = 'zho'
- MQG = 'msa'
- MRJ = 'chm'
- MSC = 'man'
- MSH = 'mlg'
- MSI = 'msa'
- MTR = 'mwr'
- MUI = 'msa'
- MUP = 'raj'
- MUQ = 'hmn'
- MVE = 'mwr'
- MVF = 'mon'
- MWK = 'man'
- MWW = 'hmn'
- MYQ = 'man'
- NAN = 'zho'
- NHD = 'grn'
- NIQ = 'kln'
- NLE = 'luy'
- NNO = 'nor'
- NOB = 'nor'
- NPI = 'nep'
- NYD = 'luy'
- OBK = 'bnc'
- OJB = 'oji'
- OJC = 'oji'
- OJG = 'oji'
- OJS = 'oji'
- OJW = 'oji'
- OKI = 'kln'
- ORC = 'orm'
- ORN = 'msa'
- ORS = 'msa'
- ORY = 'ori'
- OTW = 'oji'
- PBT = 'pus'
- PBU = 'pus'
- PEL = 'msa'
- PES = 'fas'
- PGA = 'ara'
- PHR = 'lah'
- PKO = 'kln'
- PLT = 'mlg'
- PMU = 'lah'
- PNB = 'lah'
- PRS = 'fas'
- PSE = 'msa'
- PST = 'pus'
- QUB = 'que'
- QUD = 'que'
- QUF = 'que'
- QUG = 'que'
- QUH = 'que'
- QUK = 'que'
- QUL = 'que'
- QUP = 'que'
- QUR = 'que'
- QUS = 'que'
- QUW = 'que'
- QUX = 'que'
- QUY = 'que'
- QUZ = 'que'
- QVA = 'que'
- QVC = 'que'
- QVE = 'que'
- QVH = 'que'
- QVI = 'que'
- QVJ = 'que'
- QVL = 'que'
- QVM = 'que'
- QVN = 'que'
- QVO = 'que'
- QVP = 'que'
- QVS = 'que'
- QVW = 'que'
- QVZ = 'que'
- QWA = 'que'
- QWC = 'que'
- QWH = 'que'
- QWS = 'que'
- QXA = 'que'
- QXC = 'que'
- QXH = 'que'
- QXL = 'que'
- QXN = 'que'
- QXO = 'que'
- QXP = 'que'
- QXR = 'que'
- QXT = 'que'
- QXU = 'que'
- QXW = 'que'
- RAG = 'luy'
- RBK = 'bnc'
- RBL = 'bik'
- RMC = 'rom'
- RMF = 'rom'
- RML = 'rom'
- RMN = 'rom'
- RMO = 'rom'
- RMW = 'rom'
- RMY = 'rom'
- RWR = 'mwr'
- SCS = 'den'
- SDC = 'srd'
- SDH = 'kur'
- SDN = 'srd'
- SFM = 'hmn'
- SGC = 'kln'
- SHU = 'ara'
- SKG = 'mlg'
- SKR = 'lah'
- SPV = 'ori'
- SPY = 'kln'
- SRC = 'srd'
- SRO = 'srd'
- SRP = 'hbs'
- SSH = 'ara'
- SWC = 'swa'
- SWH = 'swa'
- SWV = 'mwr'
- TAQ = 'tmh'
- TDX = 'mlg'
- TEC = 'kln'
- THV = 'tmh'
- THZ = 'tmh'
- TKG = 'mlg'
- TMW = 'msa'
- TTQ = 'tmh'
- TUY = 'kln'
- TWI = 'aka'
- TXY = 'mlg'
- UBL = 'bik'
- UMU = 'del'
- UNM = 'del'
- URK = 'msa'
- UZN = 'uzb'
- UZS = 'uzb'
- VBK = 'bnc'
- VKK = 'msa'
- VKT = 'msa'
- VRO = 'est'
- VSN = 'san'
- WBR = 'raj'
- WRY = 'mwr'
- WSG = 'gon'
- WUU = 'zho'
- XHE = 'lah'
- XMM = 'msa'
- XMV = 'mlg'
- XMW = 'mlg'
- XNR = 'doi'
- XPE = 'kpe'
- XSL = 'den'
- YDD = 'yid'
- YHD = 'jrb'
- YIH = 'yid'
- YUD = 'jrb'
- YUE = 'zho'
- ZAA = 'zap'
- ZAB = 'zap'
- ZAC = 'zap'
- ZAD = 'zap'
- ZAE = 'zap'
- ZAF = 'zap'
- ZAI = 'zap'
- ZAM = 'zap'
- ZAO = 'zap'
- ZAQ = 'zap'
- ZAR = 'zap'
- ZAS = 'zap'
- ZAT = 'zap'
- ZAV = 'zap'
- ZAW = 'zap'
- ZAX = 'zap'
- ZCA = 'zap'
- ZCD = 'zap'
- ZCH = 'zha'
- ZEH = 'zha'
- ZGB = 'zha'
- ZGM = 'zha'
- ZGN = 'zha'
- ZHD = 'zha'
- ZHN = 'zha'
- ZLJ = 'zha'
- ZLM = 'msa'
- ZLN = 'zha'
- ZLQ = 'zha'
- ZMI = 'msa'
- ZOO = 'zap'
- ZPA = 'zap'
- ZPB = 'zap'
- ZPC = 'zap'
- ZPD = 'zap'
- ZPE = 'zap'
- ZPF = 'zap'
- ZPG = 'zap'
- ZPH = 'zap'
- ZPI = 'zap'
- ZPJ = 'zap'
- ZPK = 'zap'
- ZPL = 'zap'
- ZPM = 'zap'
- ZPN = 'zap'
- ZPO = 'zap'
- ZPP = 'zap'
- ZPQ = 'zap'
- ZPR = 'zap'
- ZPS = 'zap'
- ZPT = 'zap'
- ZPU = 'zap'
- ZPV = 'zap'
- ZPW = 'zap'
- ZPX = 'zap'
- ZPY = 'zap'
- ZPZ = 'zap'
- ZQE = 'zha'
- ZSM = 'msa'
- ZSR = 'zap'
- ZTC = 'zap'
- ZTE = 'zap'
- ZTG = 'zap'
- ZTL = 'zap'
- ZTM = 'zap'
- ZTN = 'zap'
- ZTP = 'zap'
- ZTQ = 'zap'
- ZTS = 'zap'
- ZTT = 'zap'
- ZTU = 'zap'
- ZTX = 'zap'
- ZTY = 'zap'
- ZYB = 'zha'
- ZYG = 'zha'
- ZYJ = 'zha'
- ZYN = 'zha'
- ZZJ = 'zha'
- property i_id: str
Returns: 3 chars. The identifier for an individual language that is a member of the macrolanguage.
- property i_status: Literal['A', 'R']
Returns: A(active) or R(retired) indicating the status of the individual code element.
- property m_id: str
Returns: 3 chars. The identifier for a macrolanguage.
- property unit: MacroLanguageUnit
Returns:
pycountries.macro_languages.MacroLanguageUnit.
- property value: str
Returns: 3 chars. The identifier for a macrolanguage.
- class pycountries.macro_languages.MacroLanguageUnit[source]
Bases:
BaseModel- i_status: Literal['A', 'R']
- m_id: str
- model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[Dict[str, FieldInfo]] = {'i_status': FieldInfo(annotation=Literal['A', 'R'], required=True, description='A(active) or R(retired) indicating the status of the individual code element.'), 'm_id': FieldInfo(annotation=str, required=True, description='The identifier for a macrolanguage.', metadata=[MinLen(min_length=3), MaxLen(max_length=3)])}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.
This replaces Model.__fields__ from Pydantic V1.
pycountries.phones module
- class pycountries.phones.Phone[source]
Bases:
Enum- AD = 376
- AE = 971
- AF = 93
- AG = 1
- AI = 1
- AL = 355
- AM = 374
- AO = 244
- AR = 54
- AS = 1
- AT = 43
- AU = 61
- AW = 297
- AX = 358
- AZ = 994
- BA = 387
- BB = 1
- BD = 880
- BE = 32
- BF = 226
- BG = 359
- BH = 973
- BI = 257
- BJ = 229
- BL = 590
- BM = 1
- BN = 673
- BO = 591
- BQ = 599
- BR = 55
- BS = 1
- BT = 975
- BW = 267
- BY = 375
- BZ = 501
- CA = 1
- CC = 61
- CD = 243
- CF = 236
- CG = 242
- CH = 41
- CI = 225
- CK = 682
- CL = 56
- CM = 237
- CN = 86
- CO = 57
- CR = 506
- CU = 53
- CV = 238
- CW = 599
- CX = 61
- CY = 357
- CZ = 420
- DE = 49
- DJ = 253
- DK = 45
- DM = 1
- DO = 1
- DZ = 213
- EC = 593
- EE = 372
- EG = 20
- EH = 212
- ER = 291
- ES = 34
- ET = 251
- FI = 358
- FJ = 679
- FK = 500
- FM = 691
- FO = 298
- FR = 33
- GA = 241
- GB = 44
- GD = 1
- GE = 995
- GF = 594
- GG = 44
- GH = 233
- GI = 350
- GL = 299
- GM = 220
- GN = 224
- GP = 590
- GQ = 240
- GR = 30
- GT = 502
- GU = 1
- GW = 245
- GY = 592
- HK = 852
- HN = 504
- HR = 385
- HT = 509
- HU = 36
- ID = 62
- IE = 353
- IL = 972
- IM = 44
- IN = 91
- IO = 246
- IQ = 964
- IR = 98
- IS = 354
- IT = 39
- JE = 44
- JM = 1
- JO = 962
- JP = 81
- KE = 254
- KG = 996
- KH = 855
- KI = 686
- KM = 269
- KN = 1
- KP = 850
- KR = 82
- KW = 965
- KY = 1
- KZ = 7
- LA = 856
- LB = 961
- LC = 1
- LI = 423
- LK = 94
- LR = 231
- LS = 266
- LT = 370
- LU = 352
- LV = 371
- LY = 218
- MA = 212
- MC = 377
- MD = 373
- ME = 382
- MF = 590
- MG = 261
- MH = 692
- MK = 389
- ML = 223
- MM = 95
- MN = 976
- MO = 853
- MP = 1
- MQ = 596
- MR = 222
- MS = 1
- MT = 356
- MU = 230
- MV = 960
- MW = 265
- MX = 52
- MY = 60
- MZ = 258
- NA = 264
- NC = 687
- NE = 227
- NF = 672
- NG = 234
- NI = 505
- NL = 31
- NO = 47
- NP = 977
- NR = 674
- NU = 683
- NZ = 64
- OM = 968
- PA = 507
- PE = 51
- PF = 689
- PG = 675
- PH = 63
- PK = 92
- PL = 48
- PM = 508
- PN = 870
- PR = 1
- PS = 970
- PT = 351
- PW = 680
- PY = 595
- QA = 974
- RE = 262
- RO = 40
- RS = 381
- RU = 7
- RW = 250
- SA = 966
- SB = 677
- SC = 248
- SD = 249
- SE = 46
- SG = 65
- SH = 290
- SI = 386
- SJ = 47
- SK = 421
- SL = 232
- SM = 378
- SN = 221
- SO = 252
- SR = 597
- SS = 211
- ST = 239
- SV = 503
- SX = 599
- SY = 963
- SZ = 268
- TC = 1
- TD = 235
- TG = 228
- TH = 66
- TJ = 992
- TK = 690
- TL = 670
- TM = 993
- TN = 216
- TO = 676
- TR = 90
- TT = 1
- TV = 688
- TW = 886
- TZ = 255
- UA = 380
- UG = 256
- UM = 1
- US = 1
- UY = 598
- UZ = 998
- VA = 379
- VC = 1
- VE = 58
- VG = 1
- VI = 1
- VN = 84
- VU = 678
- WF = 681
- WS = 685
- YE = 967
- YT = 262
- ZA = 27
- ZM = 260
- ZW = 263
- property calling_code: int
Returns: int: International calling code.
- property prefixes: list[int]
- property value: int
Returns: ISO 3166-1 Alpha 2 code.
- class pycountries.phones.PhoneUnit[source]
Bases:
PhoneUnitBase- model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[Dict[str, FieldInfo]] = {'calling_code': FieldInfo(annotation=int, required=True, description='International calling code'), 'country': FieldInfo(annotation=Country, required=True), 'prefixes': FieldInfo(annotation=list[int], required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.
This replaces Model.__fields__ from Pydantic V1.
- prefixes: list[int]
- class pycountries.phones.PhoneUnitBase[source]
Bases:
BaseModel- calling_code: int
- model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[Dict[str, FieldInfo]] = {'calling_code': FieldInfo(annotation=int, required=True, description='International calling code'), 'country': FieldInfo(annotation=Country, required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.
This replaces Model.__fields__ from Pydantic V1.
Module contents
- exception pycountries.AmountSpecialValuesNotAllowedError[source]
Bases:
BaseCurrencyErrorAmount Special Values Not Allowed Error.
- class pycountries.Country[source]
Bases:
EnumCountry Enum, a comprehensive collection that incorporates essential identifiers according to the ISO 3166-1 standard. It encompasses the ISO 3166-1 Alpha-2 code, which consists of two-letter country codes, the ISO 3166-1 Alpha-3 code, comprising three-letter country codes, and the ISO 3166-1 numeric code, which provides a three-digit numerical representation for each country.
Additionally, the Country Enum includes the full country names corresponding to these codes, offering a complete reference for identifying and categorizing countries worldwide.
- AD = 'AD'
- AE = 'AE'
- AF = 'AF'
- AG = 'AG'
- AI = 'AI'
- AL = 'AL'
- AM = 'AM'
- AO = 'AO'
- AQ = 'AQ'
- AR = 'AR'
- AS = 'AS'
- AT = 'AT'
- AU = 'AU'
- AW = 'AW'
- AX = 'AX'
- AZ = 'AZ'
- BA = 'BA'
- BB = 'BB'
- BD = 'BD'
- BE = 'BE'
- BF = 'BF'
- BG = 'BG'
- BH = 'BH'
- BI = 'BI'
- BJ = 'BJ'
- BL = 'BL'
- BM = 'BM'
- BN = 'BN'
- BO = 'BO'
- BQ = 'BQ'
- BR = 'BR'
- BS = 'BS'
- BT = 'BT'
- BV = 'BV'
- BW = 'BW'
- BY = 'BY'
- BZ = 'BZ'
- CA = 'CA'
- CC = 'CC'
- CD = 'CD'
- CF = 'CF'
- CG = 'CG'
- CH = 'CH'
- CI = 'CI'
- CK = 'CK'
- CL = 'CL'
- CM = 'CM'
- CN = 'CN'
- CO = 'CO'
- CR = 'CR'
- CU = 'CU'
- CV = 'CV'
- CW = 'CW'
- CX = 'CX'
- CY = 'CY'
- CZ = 'CZ'
- DE = 'DE'
- DJ = 'DJ'
- DK = 'DK'
- DM = 'DM'
- DO = 'DO'
- DZ = 'DZ'
- EC = 'EC'
- EE = 'EE'
- EG = 'EG'
- EH = 'EH'
- ER = 'ER'
- ES = 'ES'
- ET = 'ET'
- FI = 'FI'
- FJ = 'FJ'
- FK = 'FK'
- FM = 'FM'
- FO = 'FO'
- FR = 'FR'
- GA = 'GA'
- GB = 'GB'
- GD = 'GD'
- GE = 'GE'
- GF = 'GF'
- GG = 'GG'
- GH = 'GH'
- GI = 'GI'
- GL = 'GL'
- GM = 'GM'
- GN = 'GN'
- GP = 'GP'
- GQ = 'GQ'
- GR = 'GR'
- GS = 'GS'
- GT = 'GT'
- GU = 'GU'
- GW = 'GW'
- GY = 'GY'
- HK = 'HK'
- HM = 'HM'
- HN = 'HN'
- HR = 'HR'
- HT = 'HT'
- HU = 'HU'
- ID = 'ID'
- IE = 'IE'
- IL = 'IL'
- IM = 'IM'
- IN = 'IN'
- IO = 'IO'
- IQ = 'IQ'
- IR = 'IR'
- IS = 'IS'
- IT = 'IT'
- JE = 'JE'
- JM = 'JM'
- JO = 'JO'
- JP = 'JP'
- KE = 'KE'
- KG = 'KG'
- KH = 'KH'
- KI = 'KI'
- KM = 'KM'
- KN = 'KN'
- KP = 'KP'
- KR = 'KR'
- KW = 'KW'
- KY = 'KY'
- KZ = 'KZ'
- LA = 'LA'
- LB = 'LB'
- LC = 'LC'
- LI = 'LI'
- LK = 'LK'
- LR = 'LR'
- LS = 'LS'
- LT = 'LT'
- LU = 'LU'
- LV = 'LV'
- LY = 'LY'
- MA = 'MA'
- MC = 'MC'
- MD = 'MD'
- ME = 'ME'
- MF = 'MF'
- MG = 'MG'
- MH = 'MH'
- MK = 'MK'
- ML = 'ML'
- MM = 'MM'
- MN = 'MN'
- MO = 'MO'
- MP = 'MP'
- MQ = 'MQ'
- MR = 'MR'
- MS = 'MS'
- MT = 'MT'
- MU = 'MU'
- MV = 'MV'
- MW = 'MW'
- MX = 'MX'
- MY = 'MY'
- MZ = 'MZ'
- NA = 'NA'
- NC = 'NC'
- NE = 'NE'
- NF = 'NF'
- NG = 'NG'
- NI = 'NI'
- NL = 'NL'
- NO = 'NO'
- NP = 'NP'
- NR = 'NR'
- NU = 'NU'
- NZ = 'NZ'
- OM = 'OM'
- PA = 'PA'
- PE = 'PE'
- PF = 'PF'
- PG = 'PG'
- PH = 'PH'
- PK = 'PK'
- PL = 'PL'
- PM = 'PM'
- PN = 'PN'
- PR = 'PR'
- PS = 'PS'
- PT = 'PT'
- PW = 'PW'
- PY = 'PY'
- QA = 'QA'
- RE = 'RE'
- RO = 'RO'
- RS = 'RS'
- RU = 'RU'
- RW = 'RW'
- SA = 'SA'
- SB = 'SB'
- SC = 'SC'
- SD = 'SD'
- SE = 'SE'
- SG = 'SG'
- SH = 'SH'
- SI = 'SI'
- SJ = 'SJ'
- SK = 'SK'
- SL = 'SL'
- SM = 'SM'
- SN = 'SN'
- SO = 'SO'
- SR = 'SR'
- SS = 'SS'
- ST = 'ST'
- SV = 'SV'
- SX = 'SX'
- SY = 'SY'
- SZ = 'SZ'
- TC = 'TC'
- TD = 'TD'
- TF = 'TF'
- TG = 'TG'
- TH = 'TH'
- TJ = 'TJ'
- TK = 'TK'
- TL = 'TL'
- TM = 'TM'
- TN = 'TN'
- TO = 'TO'
- TR = 'TR'
- TT = 'TT'
- TV = 'TV'
- TW = 'TW'
- TZ = 'TZ'
- UA = 'UA'
- UG = 'UG'
- UM = 'UM'
- US = 'US'
- UY = 'UY'
- UZ = 'UZ'
- VA = 'VA'
- VC = 'VC'
- VE = 'VE'
- VG = 'VG'
- VI = 'VI'
- VN = 'VN'
- VU = 'VU'
- WF = 'WF'
- WS = 'WS'
- YE = 'YE'
- YT = 'YT'
- ZA = 'ZA'
- ZM = 'ZM'
- ZW = 'ZW'
- property alpha_2: str
This code is used as part of domain names, vehicle registration plates, and in international transactions, among other purposes.
- Returns:
ISO 3166-1 Alpha 2 code.
- property alpha_3: str
This code is commonly used in various international contexts, including identifying countries in internet domains, representing countries in airline ticketing, and facilitating international trade.
- Returns:
ISO 3166-1 Alpha 3 code.
- property name: str
Unofficial country name, known as shorten country name.
- Returns:
ISO 3166 name.
- property numeric
This code is used in various contexts where numeric representations are preferred over alphanumeric ones, such as in databases or systems where numerical identifiers are easier to work with.
- Returns:
ISO 3166-1 numeric code.
- property official_name: str
Official country name.
- Returns:
World Factbook official state name.
- property unit: CountryUnit
Returns:
pycountries.countries.CountryUnit.
- property value
Returns: ISO 3166-1 Alpha 2 code.
- class pycountries.Currency[source]
Bases:
EnumThe Currency Enum is a comprehensive collection designed to facilitate currency handling in software applications. It encompasses the ISO 4217 standard, which defines alphabetic and numeric codes for currencies, along with their corresponding full names.
This Enum provides developers with a structured and standardized way to represent and manage currencies. Whether for financial transactions, currency conversion, or reporting purposes, the Currency Enum offers a reliable reference for accurately identifying and working with currencies across diverse software environments.
- AED = 'AED'
- AFN = 'AFN'
- ALL = 'ALL'
- AMD = 'AMD'
- ANG = 'ANG'
- AOA = 'AOA'
- ARS = 'ARS'
- AUD = 'AUD'
- AWG = 'AWG'
- AZN = 'AZN'
- BAM = 'BAM'
- BBD = 'BBD'
- BDT = 'BDT'
- BGN = 'BGN'
- BHD = 'BHD'
- BIF = 'BIF'
- BMD = 'BMD'
- BND = 'BND'
- BOB = 'BOB'
- BOV = 'BOV'
- BRL = 'BRL'
- BSD = 'BSD'
- BTN = 'BTN'
- BWP = 'BWP'
- BYN = 'BYN'
- BZD = 'BZD'
- CAD = 'CAD'
- CDF = 'CDF'
- CHE = 'CHE'
- CHF = 'CHF'
- CHW = 'CHW'
- CLF = 'CLF'
- CLP = 'CLP'
- CNY = 'CNY'
- COP = 'COP'
- COU = 'COU'
- CRC = 'CRC'
- CUC = 'CUC'
- CUP = 'CUP'
- CVE = 'CVE'
- CZK = 'CZK'
- DJF = 'DJF'
- DKK = 'DKK'
- DOP = 'DOP'
- DZD = 'DZD'
- EGP = 'EGP'
- ERN = 'ERN'
- ETB = 'ETB'
- EUR = 'EUR'
- FJD = 'FJD'
- FKP = 'FKP'
- GBP = 'GBP'
- GEL = 'GEL'
- GHS = 'GHS'
- GIP = 'GIP'
- GMD = 'GMD'
- GNF = 'GNF'
- GTQ = 'GTQ'
- GYD = 'GYD'
- HKD = 'HKD'
- HNL = 'HNL'
- HRK = 'HRK'
- HTG = 'HTG'
- HUF = 'HUF'
- IDR = 'IDR'
- ILS = 'ILS'
- INR = 'INR'
- IQD = 'IQD'
- IRR = 'IRR'
- ISK = 'ISK'
- JMD = 'JMD'
- JOD = 'JOD'
- JPY = 'JPY'
- KES = 'KES'
- KGS = 'KGS'
- KHR = 'KHR'
- KMF = 'KMF'
- KPW = 'KPW'
- KRW = 'KRW'
- KWD = 'KWD'
- KYD = 'KYD'
- KZT = 'KZT'
- LAK = 'LAK'
- LBP = 'LBP'
- LKR = 'LKR'
- LRD = 'LRD'
- LSL = 'LSL'
- LYD = 'LYD'
- MAD = 'MAD'
- MDL = 'MDL'
- MGA = 'MGA'
- MKD = 'MKD'
- MMK = 'MMK'
- MNT = 'MNT'
- MOP = 'MOP'
- MRU = 'MRU'
- MUR = 'MUR'
- MVR = 'MVR'
- MWK = 'MWK'
- MXN = 'MXN'
- MXV = 'MXV'
- MYR = 'MYR'
- MZN = 'MZN'
- NAD = 'NAD'
- NGN = 'NGN'
- NIO = 'NIO'
- NOK = 'NOK'
- NPR = 'NPR'
- NZD = 'NZD'
- OMR = 'OMR'
- PAB = 'PAB'
- PEN = 'PEN'
- PGK = 'PGK'
- PHP = 'PHP'
- PKR = 'PKR'
- PLN = 'PLN'
- PYG = 'PYG'
- QAR = 'QAR'
- RON = 'RON'
- RSD = 'RSD'
- RUB = 'RUB'
- RWF = 'RWF'
- SAR = 'SAR'
- SBD = 'SBD'
- SCR = 'SCR'
- SDG = 'SDG'
- SEK = 'SEK'
- SGD = 'SGD'
- SHP = 'SHP'
- SLE = 'SLE'
- SLL = 'SLL'
- SOS = 'SOS'
- SRD = 'SRD'
- SSP = 'SSP'
- STN = 'STN'
- SVC = 'SVC'
- SYP = 'SYP'
- SZL = 'SZL'
- THB = 'THB'
- TJS = 'TJS'
- TMT = 'TMT'
- TND = 'TND'
- TOP = 'TOP'
- TRY = 'TRY'
- TTD = 'TTD'
- TWD = 'TWD'
- TZS = 'TZS'
- UAH = 'UAH'
- UGX = 'UGX'
- USD = 'USD'
- USN = 'USN'
- UYI = 'UYI'
- UYU = 'UYU'
- UYW = 'UYW'
- UZS = 'UZS'
- VED = 'VED'
- VES = 'VES'
- VND = 'VND'
- VUV = 'VUV'
- WST = 'WST'
- XAF = 'XAF'
- XAG = 'XAG'
- XAU = 'XAU'
- XBA = 'XBA'
- XBB = 'XBB'
- XBC = 'XBC'
- XBD = 'XBD'
- XCD = 'XCD'
- XDR = 'XDR'
- XOF = 'XOF'
- XPD = 'XPD'
- XPF = 'XPF'
- XPT = 'XPT'
- XSU = 'XSU'
- XTS = 'XTS'
- XUA = 'XUA'
- XXX = 'XXX'
- YER = 'YER'
- ZAR = 'ZAR'
- ZMW = 'ZMW'
- ZWL = 'ZWL'
- property alpha_3: str
A three-letter alphabetic code. This alphabetic code is used internationally to represent currencies in financial transactions and data.
- Returns:
ISO 4217 code.
- clean_amount(amount, /, *, allow_zero=True)[source]
Cleans the given
amountbased on theself.unit.digitsdecimal precision.Keep in mind
amountmust be with fixed point, otherwise, the behaviour unpredictable. Why we support only fixed points? Because pydantic by default uses this representation and for payments always better to use fixed points.>>> from decimal import Decimal >>> from pycountries.currencies import ( >>> AmountSpecialValuesNotAllowedError, >>> NegativeAmountNotAllowedError, >>> WrongAmountDigitsNumberError, >>> WrongAmountTypeError, >>> ZeroAmountNotAllowedError, >>> ) >>> >>> correct_amount = Decimal("12") >>> Currency.BIF.clean_amount(correct_amount) # BIF has 0 digits >>> Decimal("12") >>> >>> wrong_special_amount = Decimal("inf") >>> try: >>> Currency.BIF.clean_amount(wrong_special_amount) >>> except AmountSpecialValuesNotAllowedError: >>> print("Amount Special Values Not Allowed") >>> >>> negative_amount = Decimal("-20.22") >>> try: >>> Currency.BIF.clean_amount(negative_amount) >>> except NegativeAmountNotAllowedError: >>> print("Negative Amount Not Allowed") >>> >>> wrong_digits_amount = Decimal("12.3") >>> try: >>> Currency.BIF.clean_amount(wrong_digits_amount) >>> except WrongAmountDigitsNumberError: >>> print("Wrong Amount Digits Number") >>> >>> wrong_type_amount = 22 >>> try: >>> Currency.BIF.clean_amount(wrong_type_amount) >>> except WrongAmountTypeError: >>> print("Wrong Amount Type") >>> >>> wrong_type_amount = Decimal("0.000") >>> try: >>> Currency.BIF.clean_amount(wrong_type_amount) >>> except ZeroAmountNotAllowedError: >>> print("Zero Amount Not Allowed") >>> >>> correct_amount_missing_digits = Decimal("12.3") >>> Currency.USD.clean_amount(correct_amount_missing_digits) # USD has 2 digits >>> Decimal("12.30")
- Parameters:
amount (decimal.Decimal) – The amount to clean. Please pass only fixed point representation.x
allow_zero (bool) – If False only non-zero values are allowed.
- Returns:
The cleaned amount with the appropriate precision.
- Return type:
decimal.Decimal
- Raises:
pycountries.WrongAmountTypeError – If
amounthas not allowed type.pycountries.NegativeAmountNotAllowedError – If
amountis negative.pycountries.ZeroAmountNotAllowedError – If
amountis zero whenallow_zerois False.pycountries.AmountSpecialValuesNotAllowedError – If
amountis infinite or NaN.pycountries.WrongAmountDigitsNumberError – If
amounthas more digites than currency can have.
- property digits: int
Maximum currency digits. The maximum currency digits for many major currencies like the US Dollar (USD), Euro (EUR), and British Pound Sterling (GBP) is 2, meaning that values are typically rounded to two decimal places. However, there are exceptions, such as the Kuwaiti Dinar (KWD), which has a maximum currency digits of 3.
- Returns:
ISO 4217 decimal.
- property name: str
The full currency name.
- Returns:
ISO 4217 name.
- property numeric: str
Numeric code. Preferred over alphabetic ones, such as in databases or systems where numeric identifiers are easier to work with.
- Returns:
ISO 4217 numeric.
- three_digits = [Currency.Bahraini Dinar, Currency.Jordanian Dinar, Currency.Kuwaiti Dinar, Currency.Rial Omani, Currency.Tunisian Dinar]
- two_digits = [Currency.UAE Dirham, Currency.Afghani, Currency.Lek, Currency.Armenian Dram, Currency.Netherlands Antillean Guilder, Currency.Kwanza, Currency.Argentine Peso, Currency.Australian Dollar, Currency.Aruban Florin, Currency.Azerbaijan Manat, Currency.Convertible Mark, Currency.Barbados Dollar, Currency.Taka, Currency.Bulgarian Lev, Currency.Bermudian Dollar, Currency.Brunei Dollar, Currency.Boliviano, Currency.Mvdol, Currency.Brazilian Real, Currency.Bahamian Dollar, Currency.Ngultrum, Currency.Pula, Currency.Belarusian Ruble, Currency.Belize Dollar, Currency.Canadian Dollar, Currency.Congolese Franc, Currency.WIR Euro, Currency.Swiss Franc, Currency.WIR Franc, Currency.Unidad de Fomento, Currency.Yuan Renminbi, Currency.Colombian Peso, Currency.Unidad de Valor Real, Currency.Costa Rican Colon, Currency.Peso Convertible, Currency.Cuban Peso, Currency.Cabo Verde Escudo, Currency.Czech Koruna, Currency.Danish Krone, Currency.Dominican Peso, Currency.Algerian Dinar, Currency.Egyptian Pound, Currency.Nakfa, Currency.Ethiopian Birr, Currency.Euro, Currency.Fiji Dollar, Currency.Falkland Islands Pound, Currency.Pound Sterling, Currency.Lari, Currency.Ghana Cedi, Currency.Gibraltar Pound, Currency.Dalasi, Currency.Quetzal, Currency.Guyana Dollar, Currency.Hong Kong Dollar, Currency.Lempira, Currency.Kuna, Currency.Gourde, Currency.Forint, Currency.Rupiah, Currency.New Israeli Sheqel, Currency.Indian Rupee, Currency.Iraqi Dinar, Currency.Iranian Rial, Currency.Iceland Krona, Currency.Jamaican Dollar, Currency.Kenyan Shilling, Currency.Som, Currency.Riel, Currency.North Korean Won, Currency.Cayman Islands Dollar, Currency.Tenge, Currency.Lao Kip, Currency.Lebanese Pound, Currency.Sri Lanka Rupee, Currency.Liberian Dollar, Currency.Loti, Currency.Libyan Dinar, Currency.Moroccan Dirham, Currency.Moldovan Leu, Currency.Denar, Currency.Kyat, Currency.Tugrik, Currency.Pataca, Currency.Ouguiya, Currency.Mauritius Rupee, Currency.Rufiyaa, Currency.Malawi Kwacha, Currency.Mexican Peso, Currency.Mexican Unidad de Inversion (UDI), Currency.Malaysian Ringgit, Currency.Mozambique Metical, Currency.Namibia Dollar, Currency.Naira, Currency.Cordoba Oro, Currency.Norwegian Krone, Currency.Nepalese Rupee, Currency.New Zealand Dollar, Currency.Balboa, Currency.Sol, Currency.Kina, Currency.Philippine Peso, Currency.Pakistan Rupee, Currency.Zloty, Currency.Qatari Rial, Currency.Romanian Leu, Currency.Serbian Dinar, Currency.Russian Ruble, Currency.Saudi Riyal, Currency.Solomon Islands Dollar, Currency.Seychelles Rupee, Currency.Sudanese Pound, Currency.Swedish Krona, Currency.Singapore Dollar, Currency.Saint Helena Pound, Currency.Leone, Currency.Leone, Currency.Somali Shilling, Currency.Surinam Dollar, Currency.South Sudanese Pound, Currency.Dobra, Currency.El Salvador Colon, Currency.Syrian Pound, Currency.Lilangeni, Currency.Baht, Currency.Somoni, Currency.Turkmenistan New Manat, Currency.Pa’anga, Currency.Turkish Lira, Currency.Trinidad and Tobago Dollar, Currency.New Taiwan Dollar, Currency.Tanzanian Shilling, Currency.Hryvnia, Currency.US Dollar, Currency.US Dollar (Next day), Currency.Uruguay Peso en Unidades Indexadas (UI), Currency.Peso Uruguayo, Currency.Unidad Previsional, Currency.Uzbekistan Sum, Currency.Bolívar Soberano, Currency.Bolívar Soberano, Currency.Tala, Currency.Silver, Currency.Gold, Currency.Bond Markets Unit European Composite Unit (EURCO), Currency.Bond Markets Unit European Monetary Unit (E.M.U.-6), Currency.Bond Markets Unit European Unit of Account 9 (E.U.A.-9), Currency.Bond Markets Unit European Unit of Account 17 (E.U.A.-17), Currency.East Caribbean Dollar, Currency.SDR (Special Drawing Right), Currency.Palladium, Currency.Platinum, Currency.Sucre, Currency.Codes specifically reserved for testing purposes, Currency.ADB Unit of Account, Currency.The codes assigned for transactions where no currency is involved, Currency.Yemeni Rial, Currency.Rand, Currency.Zambian Kwacha, Currency.Zimbabwe Dollar]
- property unit: CurrencyUnit
Returns:
pycountries.currencies.CurrencyUnit.
- property value: str
Returns: ISO 4217 code.
- zero_digits = [Currency.Burundi Franc, Currency.Chilean Peso, Currency.Djibouti Franc, Currency.Guinean Franc, Currency.Yen, Currency.Comorian Franc, Currency.Won, Currency.Malagasy Ariary, Currency.Guarani, Currency.Rwanda Franc, Currency.Uganda Shilling, Currency.Dong, Currency.Vatu, Currency.CFA Franc BEAC, Currency.CFA Franc BCEAO, Currency.CFP Franc]
- class pycountries.Language[source]
Bases:
EnumThe Language Enum comprises the ISO 639 standard, encompassing both the two-letter Alpha-2 codes and the three-letter Alpha-3 codes. Additionally, certain languages may have alternative codes designated for bibliographic or terminology purposes.
- AAR = 'aar'
- ABK = 'abk'
- ACE = 'ace'
- ACH = 'ach'
- ADA = 'ada'
- ADY = 'ady'
- AFA = 'afa'
- AFH = 'afh'
- AFR = 'afr'
- AIN = 'ain'
- AKA = 'aka'
- AKK = 'akk'
- ALB = 'alb'
- ALE = 'ale'
- ALG = 'alg'
- ALT = 'alt'
- AMH = 'amh'
- ANG = 'ang'
- ANP = 'anp'
- APA = 'apa'
- ARA = 'ara'
- ARC = 'arc'
- ARG = 'arg'
- ARM = 'arm'
- ARN = 'arn'
- ARP = 'arp'
- ART = 'art'
- ARW = 'arw'
- ASM = 'asm'
- AST = 'ast'
- ATH = 'ath'
- AUS = 'aus'
- AVA = 'ava'
- AVE = 'ave'
- AWA = 'awa'
- AYM = 'aym'
- AZE = 'aze'
- BAD = 'bad'
- BAI = 'bai'
- BAK = 'bak'
- BAL = 'bal'
- BAM = 'bam'
- BAN = 'ban'
- BAQ = 'baq'
- BAS = 'bas'
- BAT = 'bat'
- BEJ = 'bej'
- BEL = 'bel'
- BEM = 'bem'
- BEN = 'ben'
- BER = 'ber'
- BHO = 'bho'
- BIH = 'bih'
- BIK = 'bik'
- BIN = 'bin'
- BIS = 'bis'
- BLA = 'bla'
- BNT = 'bnt'
- BOD = 'bod'
- BOS = 'bos'
- BRA = 'bra'
- BRE = 'bre'
- BTK = 'btk'
- BUA = 'bua'
- BUG = 'bug'
- BUL = 'bul'
- BUR = 'bur'
- BYN = 'byn'
- CAD = 'cad'
- CAI = 'cai'
- CAR = 'car'
- CAT = 'cat'
- CAU = 'cau'
- CEB = 'ceb'
- CEL = 'cel'
- CES = 'ces'
- CHA = 'cha'
- CHB = 'chb'
- CHE = 'che'
- CHG = 'chg'
- CHI = 'chi'
- CHK = 'chk'
- CHM = 'chm'
- CHN = 'chn'
- CHO = 'cho'
- CHP = 'chp'
- CHR = 'chr'
- CHU = 'chu'
- CHV = 'chv'
- CHY = 'chy'
- CMC = 'cmc'
- CNR = 'cnr'
- COP = 'cop'
- COR = 'cor'
- COS = 'cos'
- CPE = 'cpe'
- CPF = 'cpf'
- CPP = 'cpp'
- CRE = 'cre'
- CRH = 'crh'
- CRP = 'crp'
- CSB = 'csb'
- CUS = 'cus'
- CYM = 'cym'
- CZE = 'cze'
- DAK = 'dak'
- DAN = 'dan'
- DAR = 'dar'
- DAY = 'day'
- DEL = 'del'
- DEN = 'den'
- DEU = 'deu'
- DGR = 'dgr'
- DIN = 'din'
- DIV = 'div'
- DOI = 'doi'
- DRA = 'dra'
- DSB = 'dsb'
- DUA = 'dua'
- DUM = 'dum'
- DUT = 'dut'
- DYU = 'dyu'
- DZO = 'dzo'
- EFI = 'efi'
- EGY = 'egy'
- EKA = 'eka'
- ELL = 'ell'
- ELX = 'elx'
- ENG = 'eng'
- ENM = 'enm'
- EPO = 'epo'
- EST = 'est'
- EUS = 'eus'
- EWE = 'ewe'
- EWO = 'ewo'
- FAN = 'fan'
- FAO = 'fao'
- FAS = 'fas'
- FAT = 'fat'
- FIJ = 'fij'
- FIL = 'fil'
- FIN = 'fin'
- FIU = 'fiu'
- FON = 'fon'
- FRA = 'fra'
- FRE = 'fre'
- FRM = 'frm'
- FRO = 'fro'
- FRR = 'frr'
- FRS = 'frs'
- FRY = 'fry'
- FUL = 'ful'
- FUR = 'fur'
- GAA = 'gaa'
- GAY = 'gay'
- GBA = 'gba'
- GEM = 'gem'
- GEO = 'geo'
- GER = 'ger'
- GEZ = 'gez'
- GIL = 'gil'
- GLA = 'gla'
- GLE = 'gle'
- GLG = 'glg'
- GLV = 'glv'
- GMH = 'gmh'
- GOH = 'goh'
- GON = 'gon'
- GOR = 'gor'
- GOT = 'got'
- GRB = 'grb'
- GRC = 'grc'
- GRE = 'gre'
- GRN = 'grn'
- GSW = 'gsw'
- GUJ = 'guj'
- GWI = 'gwi'
- HAI = 'hai'
- HAT = 'hat'
- HAU = 'hau'
- HAW = 'haw'
- HEB = 'heb'
- HER = 'her'
- HIL = 'hil'
- HIM = 'him'
- HIN = 'hin'
- HIT = 'hit'
- HMN = 'hmn'
- HMO = 'hmo'
- HRV = 'hrv'
- HSB = 'hsb'
- HUN = 'hun'
- HUP = 'hup'
- HYE = 'hye'
- IBA = 'iba'
- IBO = 'ibo'
- ICE = 'ice'
- IDO = 'ido'
- III = 'iii'
- IJO = 'ijo'
- IKU = 'iku'
- ILE = 'ile'
- ILO = 'ilo'
- INA = 'ina'
- INC = 'inc'
- IND = 'ind'
- INE = 'ine'
- INH = 'inh'
- IPK = 'ipk'
- IRA = 'ira'
- IRO = 'iro'
- ISL = 'isl'
- ITA = 'ita'
- JAV = 'jav'
- JBO = 'jbo'
- JPN = 'jpn'
- JPR = 'jpr'
- JRB = 'jrb'
- KAA = 'kaa'
- KAB = 'kab'
- KAC = 'kac'
- KAL = 'kal'
- KAM = 'kam'
- KAN = 'kan'
- KAR = 'kar'
- KAS = 'kas'
- KAT = 'kat'
- KAU = 'kau'
- KAW = 'kaw'
- KAZ = 'kaz'
- KBD = 'kbd'
- KHA = 'kha'
- KHI = 'khi'
- KHM = 'khm'
- KHO = 'kho'
- KIK = 'kik'
- KIN = 'kin'
- KIR = 'kir'
- KMB = 'kmb'
- KOK = 'kok'
- KOM = 'kom'
- KON = 'kon'
- KOR = 'kor'
- KOS = 'kos'
- KPE = 'kpe'
- KRC = 'krc'
- KRL = 'krl'
- KRO = 'kro'
- KRU = 'kru'
- KUA = 'kua'
- KUM = 'kum'
- KUR = 'kur'
- KUT = 'kut'
- LAD = 'lad'
- LAH = 'lah'
- LAM = 'lam'
- LAO = 'lao'
- LAT = 'lat'
- LAV = 'lav'
- LEZ = 'lez'
- LIM = 'lim'
- LIN = 'lin'
- LIT = 'lit'
- LOL = 'lol'
- LOZ = 'loz'
- LTZ = 'ltz'
- LUA = 'lua'
- LUB = 'lub'
- LUG = 'lug'
- LUI = 'lui'
- LUN = 'lun'
- LUO = 'luo'
- LUS = 'lus'
- MAC = 'mac'
- MAD = 'mad'
- MAG = 'mag'
- MAH = 'mah'
- MAI = 'mai'
- MAK = 'mak'
- MAL = 'mal'
- MAN = 'man'
- MAO = 'mao'
- MAP = 'map'
- MAR = 'mar'
- MAS = 'mas'
- MAY = 'may'
- MDF = 'mdf'
- MDR = 'mdr'
- MEN = 'men'
- MGA = 'mga'
- MIC = 'mic'
- MIN = 'min'
- MIS = 'mis'
- MKD = 'mkd'
- MKH = 'mkh'
- MLG = 'mlg'
- MLT = 'mlt'
- MNC = 'mnc'
- MNI = 'mni'
- MNO = 'mno'
- MOH = 'moh'
- MON = 'mon'
- MOS = 'mos'
- MRI = 'mri'
- MSA = 'msa'
- MUL = 'mul'
- MUN = 'mun'
- MUS = 'mus'
- MWL = 'mwl'
- MWR = 'mwr'
- MYA = 'mya'
- MYN = 'myn'
- MYV = 'myv'
- NAH = 'nah'
- NAI = 'nai'
- NAP = 'nap'
- NAU = 'nau'
- NAV = 'nav'
- NBL = 'nbl'
- NDE = 'nde'
- NDO = 'ndo'
- NDS = 'nds'
- NEP = 'nep'
- NEW = 'new'
- NIA = 'nia'
- NIC = 'nic'
- NIU = 'niu'
- NLD = 'nld'
- NNO = 'nno'
- NOB = 'nob'
- NOG = 'nog'
- NON = 'non'
- NOR = 'nor'
- NQO = 'nqo'
- NSO = 'nso'
- NUB = 'nub'
- NWC = 'nwc'
- NYA = 'nya'
- NYM = 'nym'
- NYN = 'nyn'
- NYO = 'nyo'
- NZI = 'nzi'
- OCI = 'oci'
- OJI = 'oji'
- ORI = 'ori'
- ORM = 'orm'
- OSA = 'osa'
- OSS = 'oss'
- OTA = 'ota'
- OTO = 'oto'
- PAA = 'paa'
- PAG = 'pag'
- PAL = 'pal'
- PAM = 'pam'
- PAN = 'pan'
- PAP = 'pap'
- PAU = 'pau'
- PEO = 'peo'
- PER = 'per'
- PHI = 'phi'
- PHN = 'phn'
- PLI = 'pli'
- POL = 'pol'
- PON = 'pon'
- POR = 'por'
- PRA = 'pra'
- PRO = 'pro'
- PUS = 'pus'
- QUE = 'que'
- RAJ = 'raj'
- RAP = 'rap'
- RAR = 'rar'
- ROA = 'roa'
- ROH = 'roh'
- ROM = 'rom'
- RON = 'ron'
- RUM = 'rum'
- RUN = 'run'
- RUP = 'rup'
- RUS = 'rus'
- SAD = 'sad'
- SAG = 'sag'
- SAH = 'sah'
- SAI = 'sai'
- SAL = 'sal'
- SAM = 'sam'
- SAN = 'san'
- SAS = 'sas'
- SAT = 'sat'
- SCN = 'scn'
- SCO = 'sco'
- SEL = 'sel'
- SEM = 'sem'
- SGA = 'sga'
- SGN = 'sgn'
- SHN = 'shn'
- SID = 'sid'
- SIN = 'sin'
- SIO = 'sio'
- SIT = 'sit'
- SLA = 'sla'
- SLK = 'slk'
- SLO = 'slo'
- SLV = 'slv'
- SMA = 'sma'
- SME = 'sme'
- SMI = 'smi'
- SMJ = 'smj'
- SMN = 'smn'
- SMO = 'smo'
- SMS = 'sms'
- SNA = 'sna'
- SND = 'snd'
- SNK = 'snk'
- SOG = 'sog'
- SOM = 'som'
- SON = 'son'
- SOT = 'sot'
- SPA = 'spa'
- SQI = 'sqi'
- SRD = 'srd'
- SRN = 'srn'
- SRP = 'srp'
- SRR = 'srr'
- SSA = 'ssa'
- SSW = 'ssw'
- SUK = 'suk'
- SUN = 'sun'
- SUS = 'sus'
- SUX = 'sux'
- SWA = 'swa'
- SWE = 'swe'
- SYC = 'syc'
- SYR = 'syr'
- TAH = 'tah'
- TAI = 'tai'
- TAM = 'tam'
- TAT = 'tat'
- TEL = 'tel'
- TEM = 'tem'
- TER = 'ter'
- TET = 'tet'
- TGK = 'tgk'
- TGL = 'tgl'
- THA = 'tha'
- TIB = 'tib'
- TIG = 'tig'
- TIR = 'tir'
- TIV = 'tiv'
- TKL = 'tkl'
- TLH = 'tlh'
- TLI = 'tli'
- TMH = 'tmh'
- TOG = 'tog'
- TON = 'ton'
- TPI = 'tpi'
- TSI = 'tsi'
- TSN = 'tsn'
- TSO = 'tso'
- TUK = 'tuk'
- TUM = 'tum'
- TUP = 'tup'
- TUR = 'tur'
- TUT = 'tut'
- TVL = 'tvl'
- TWI = 'twi'
- TYV = 'tyv'
- UDM = 'udm'
- UGA = 'uga'
- UIG = 'uig'
- UKR = 'ukr'
- UMB = 'umb'
- UND = 'und'
- URD = 'urd'
- UZB = 'uzb'
- VAI = 'vai'
- VEN = 'ven'
- VIE = 'vie'
- VOL = 'vol'
- VOT = 'vot'
- WAK = 'wak'
- WAL = 'wal'
- WAR = 'war'
- WAS = 'was'
- WEL = 'wel'
- WEN = 'wen'
- WLN = 'wln'
- WOL = 'wol'
- XAL = 'xal'
- XHO = 'xho'
- YAO = 'yao'
- YAP = 'yap'
- YID = 'yid'
- YOR = 'yor'
- YPK = 'ypk'
- ZAP = 'zap'
- ZBL = 'zbl'
- ZEN = 'zen'
- ZGH = 'zgh'
- ZHA = 'zha'
- ZHO = 'zho'
- ZND = 'znd'
- ZUL = 'zul'
- ZUN = 'zun'
- ZXX = 'zxx'
- ZZA = 'zza'
- property alpha_2: str | None
Returns: ISO 639-1 Alpha 2 code. Can be
None.
- property alpha_3: str
Returns: ISO 639-2 Alpha 3 code.
- property bibliographic: str | None
Returns: ISO 639-2 Alpha 3 bibliographic code.
- property terminology: str
Returns: ISO 639-2 Alpha 3 terminology code.
- property unit: LanguageUnit
Returns:
pycountries.languages.LanguageUnit.
- property value: str
Returns: ISO 639-2 Alpha 3 code.
- class pycountries.MacroLanguage[source]
Bases:
Enum- AAE = 'sqi'
- AAO = 'ara'
- AAT = 'sqi'
- ABH = 'ara'
- ABV = 'ara'
- ACM = 'ara'
- ACQ = 'ara'
- ACW = 'ara'
- ACX = 'ara'
- ACY = 'ara'
- ADF = 'ara'
- AEB = 'ara'
- AEC = 'ara'
- AFB = 'ara'
- AII = 'syr'
- AJP = 'ara'
- AJT = 'jrb'
- AJU = 'jrb'
- ALN = 'sqi'
- ALS = 'sqi'
- APC = 'ara'
- APD = 'ara'
- ARB = 'ara'
- ARQ = 'ara'
- ARS = 'ara'
- ARY = 'ara'
- ARZ = 'ara'
- AUZ = 'ara'
- AVL = 'ara'
- AYC = 'aym'
- AYH = 'ara'
- AYL = 'ara'
- AYN = 'ara'
- AYP = 'ara'
- AYR = 'aym'
- AZB = 'aze'
- AZJ = 'aze'
- BBZ = 'ara'
- BCC = 'bal'
- BCL = 'bik'
- BDT = 'gba'
- BGN = 'bal'
- BGP = 'bal'
- BGQ = 'raj'
- BHK = 'bik'
- BHR = 'mlg'
- BJN = 'msa'
- BJQ = 'mlg'
- BLN = 'bik'
- BLU = 'hmn'
- BMM = 'mlg'
- BOS = 'hbs'
- BTJ = 'msa'
- BTO = 'bik'
- BVE = 'msa'
- BVU = 'msa'
- BXK = 'luy'
- BXM = 'bua'
- BXR = 'bua'
- BXU = 'bua'
- BZC = 'mlg'
- CCX = 'zha'
- CCY = 'zha'
- CDO = 'zho'
- CIW = 'oji'
- CJY = 'zho'
- CKB = 'kur'
- CLD = 'syr'
- CLS = 'san'
- CMN = 'zho'
- CNP = 'zho'
- CNR = 'hbs'
- COA = 'msa'
- CPX = 'zho'
- CQD = 'hmn'
- CQU = 'que'
- CRJ = 'cre'
- CRK = 'cre'
- CRL = 'cre'
- CRM = 'cre'
- CSP = 'zho'
- CSW = 'cre'
- CTS = 'bik'
- CWD = 'cre'
- CZH = 'zho'
- CZO = 'zho'
- DGO = 'doi'
- DHD = 'mwr'
- DIB = 'din'
- DIK = 'din'
- DIP = 'din'
- DIQ = 'zza'
- DIW = 'din'
- DKS = 'din'
- DTY = 'nep'
- DUP = 'msa'
- EBK = 'bnc'
- EKK = 'est'
- EMK = 'man'
- ENB = 'kln'
- ESG = 'gon'
- ESI = 'ipk'
- ESK = 'ipk'
- EYO = 'kln'
- FAT = 'aka'
- FBL = 'bik'
- FFM = 'ful'
- FUB = 'ful'
- FUC = 'ful'
- FUE = 'ful'
- FUF = 'ful'
- FUH = 'ful'
- FUI = 'ful'
- FUQ = 'ful'
- FUV = 'ful'
- GAN = 'zho'
- GAX = 'orm'
- GAZ = 'orm'
- GBO = 'grb'
- GBP = 'gba'
- GBQ = 'gba'
- GDA = 'raj'
- GEC = 'grb'
- GGO = 'gon'
- GJU = 'raj'
- GKP = 'kpe'
- GMM = 'gba'
- GNO = 'gon'
- GNW = 'grn'
- GOM = 'kok'
- GRJ = 'grb'
- GRV = 'grb'
- GRY = 'grb'
- GSO = 'gba'
- GUG = 'grn'
- GUI = 'grn'
- GUN = 'grn'
- GYA = 'gba'
- HAE = 'orm'
- HAK = 'zho'
- HAX = 'hai'
- HDN = 'hai'
- HEA = 'hmn'
- HJI = 'msa'
- HMA = 'hmn'
- HMC = 'hmn'
- HMD = 'hmn'
- HME = 'hmn'
- HMG = 'hmn'
- HMH = 'hmn'
- HMI = 'hmn'
- HMJ = 'hmn'
- HML = 'hmn'
- HMM = 'hmn'
- HMP = 'hmn'
- HMQ = 'hmn'
- HMS = 'hmn'
- HMW = 'hmn'
- HMY = 'hmn'
- HMZ = 'hmn'
- HND = 'lah'
- HNJ = 'hmn'
- HNO = 'lah'
- HOJ = 'raj'
- HRM = 'hmn'
- HRV = 'hbs'
- HSN = 'zho'
- HUJ = 'hmn'
- IDA = 'luy'
- IKE = 'iku'
- IKT = 'iku'
- IND = 'msa'
- JAK = 'msa'
- JAT = 'lah'
- JAX = 'msa'
- JYE = 'jrb'
- KBY = 'kau'
- KHK = 'mon'
- KIU = 'zza'
- KMR = 'kur'
- KNC = 'kau'
- KNG = 'kon'
- KNN = 'kok'
- KOI = 'kom'
- KPV = 'kom'
- KRT = 'kau'
- KVB = 'msa'
- KVR = 'msa'
- KWY = 'kon'
- KXD = 'msa'
- LBK = 'bnc'
- LBL = 'bik'
- LCE = 'msa'
- LCF = 'msa'
- LDI = 'kon'
- LIW = 'msa'
- LKB = 'luy'
- LKO = 'luy'
- LKS = 'luy'
- LRI = 'luy'
- LRM = 'luy'
- LSM = 'luy'
- LTG = 'lav'
- LTO = 'luy'
- LTS = 'luy'
- LVS = 'lav'
- LWG = 'luy'
- LZH = 'zho'
- MAX = 'msa'
- MDO = 'gba'
- MEO = 'msa'
- MFA = 'msa'
- MFB = 'msa'
- MHR = 'chm'
- MIN = 'msa'
- MKU = 'man'
- MLQ = 'man'
- MLY = 'msa'
- MMR = 'hmn'
- MNK = 'man'
- MNP = 'zho'
- MQG = 'msa'
- MRJ = 'chm'
- MSC = 'man'
- MSH = 'mlg'
- MSI = 'msa'
- MTR = 'mwr'
- MUI = 'msa'
- MUP = 'raj'
- MUQ = 'hmn'
- MVE = 'mwr'
- MVF = 'mon'
- MWK = 'man'
- MWW = 'hmn'
- MYQ = 'man'
- NAN = 'zho'
- NHD = 'grn'
- NIQ = 'kln'
- NLE = 'luy'
- NNO = 'nor'
- NOB = 'nor'
- NPI = 'nep'
- NYD = 'luy'
- OBK = 'bnc'
- OJB = 'oji'
- OJC = 'oji'
- OJG = 'oji'
- OJS = 'oji'
- OJW = 'oji'
- OKI = 'kln'
- ORC = 'orm'
- ORN = 'msa'
- ORS = 'msa'
- ORY = 'ori'
- OTW = 'oji'
- PBT = 'pus'
- PBU = 'pus'
- PEL = 'msa'
- PES = 'fas'
- PGA = 'ara'
- PHR = 'lah'
- PKO = 'kln'
- PLT = 'mlg'
- PMU = 'lah'
- PNB = 'lah'
- PRS = 'fas'
- PSE = 'msa'
- PST = 'pus'
- QUB = 'que'
- QUD = 'que'
- QUF = 'que'
- QUG = 'que'
- QUH = 'que'
- QUK = 'que'
- QUL = 'que'
- QUP = 'que'
- QUR = 'que'
- QUS = 'que'
- QUW = 'que'
- QUX = 'que'
- QUY = 'que'
- QUZ = 'que'
- QVA = 'que'
- QVC = 'que'
- QVE = 'que'
- QVH = 'que'
- QVI = 'que'
- QVJ = 'que'
- QVL = 'que'
- QVM = 'que'
- QVN = 'que'
- QVO = 'que'
- QVP = 'que'
- QVS = 'que'
- QVW = 'que'
- QVZ = 'que'
- QWA = 'que'
- QWC = 'que'
- QWH = 'que'
- QWS = 'que'
- QXA = 'que'
- QXC = 'que'
- QXH = 'que'
- QXL = 'que'
- QXN = 'que'
- QXO = 'que'
- QXP = 'que'
- QXR = 'que'
- QXT = 'que'
- QXU = 'que'
- QXW = 'que'
- RAG = 'luy'
- RBK = 'bnc'
- RBL = 'bik'
- RMC = 'rom'
- RMF = 'rom'
- RML = 'rom'
- RMN = 'rom'
- RMO = 'rom'
- RMW = 'rom'
- RMY = 'rom'
- RWR = 'mwr'
- SCS = 'den'
- SDC = 'srd'
- SDH = 'kur'
- SDN = 'srd'
- SFM = 'hmn'
- SGC = 'kln'
- SHU = 'ara'
- SKG = 'mlg'
- SKR = 'lah'
- SPV = 'ori'
- SPY = 'kln'
- SRC = 'srd'
- SRO = 'srd'
- SRP = 'hbs'
- SSH = 'ara'
- SWC = 'swa'
- SWH = 'swa'
- SWV = 'mwr'
- TAQ = 'tmh'
- TDX = 'mlg'
- TEC = 'kln'
- THV = 'tmh'
- THZ = 'tmh'
- TKG = 'mlg'
- TMW = 'msa'
- TTQ = 'tmh'
- TUY = 'kln'
- TWI = 'aka'
- TXY = 'mlg'
- UBL = 'bik'
- UMU = 'del'
- UNM = 'del'
- URK = 'msa'
- UZN = 'uzb'
- UZS = 'uzb'
- VBK = 'bnc'
- VKK = 'msa'
- VKT = 'msa'
- VRO = 'est'
- VSN = 'san'
- WBR = 'raj'
- WRY = 'mwr'
- WSG = 'gon'
- WUU = 'zho'
- XHE = 'lah'
- XMM = 'msa'
- XMV = 'mlg'
- XMW = 'mlg'
- XNR = 'doi'
- XPE = 'kpe'
- XSL = 'den'
- YDD = 'yid'
- YHD = 'jrb'
- YIH = 'yid'
- YUD = 'jrb'
- YUE = 'zho'
- ZAA = 'zap'
- ZAB = 'zap'
- ZAC = 'zap'
- ZAD = 'zap'
- ZAE = 'zap'
- ZAF = 'zap'
- ZAI = 'zap'
- ZAM = 'zap'
- ZAO = 'zap'
- ZAQ = 'zap'
- ZAR = 'zap'
- ZAS = 'zap'
- ZAT = 'zap'
- ZAV = 'zap'
- ZAW = 'zap'
- ZAX = 'zap'
- ZCA = 'zap'
- ZCD = 'zap'
- ZCH = 'zha'
- ZEH = 'zha'
- ZGB = 'zha'
- ZGM = 'zha'
- ZGN = 'zha'
- ZHD = 'zha'
- ZHN = 'zha'
- ZLJ = 'zha'
- ZLM = 'msa'
- ZLN = 'zha'
- ZLQ = 'zha'
- ZMI = 'msa'
- ZOO = 'zap'
- ZPA = 'zap'
- ZPB = 'zap'
- ZPC = 'zap'
- ZPD = 'zap'
- ZPE = 'zap'
- ZPF = 'zap'
- ZPG = 'zap'
- ZPH = 'zap'
- ZPI = 'zap'
- ZPJ = 'zap'
- ZPK = 'zap'
- ZPL = 'zap'
- ZPM = 'zap'
- ZPN = 'zap'
- ZPO = 'zap'
- ZPP = 'zap'
- ZPQ = 'zap'
- ZPR = 'zap'
- ZPS = 'zap'
- ZPT = 'zap'
- ZPU = 'zap'
- ZPV = 'zap'
- ZPW = 'zap'
- ZPX = 'zap'
- ZPY = 'zap'
- ZPZ = 'zap'
- ZQE = 'zha'
- ZSM = 'msa'
- ZSR = 'zap'
- ZTC = 'zap'
- ZTE = 'zap'
- ZTG = 'zap'
- ZTL = 'zap'
- ZTM = 'zap'
- ZTN = 'zap'
- ZTP = 'zap'
- ZTQ = 'zap'
- ZTS = 'zap'
- ZTT = 'zap'
- ZTU = 'zap'
- ZTX = 'zap'
- ZTY = 'zap'
- ZYB = 'zha'
- ZYG = 'zha'
- ZYJ = 'zha'
- ZYN = 'zha'
- ZZJ = 'zha'
- property i_id: str
Returns: 3 chars. The identifier for an individual language that is a member of the macrolanguage.
- property i_status: Literal['A', 'R']
Returns: A(active) or R(retired) indicating the status of the individual code element.
- property m_id: str
Returns: 3 chars. The identifier for a macrolanguage.
- property unit: MacroLanguageUnit
Returns:
pycountries.macro_languages.MacroLanguageUnit.
- property value: str
Returns: 3 chars. The identifier for a macrolanguage.
- exception pycountries.NegativeAmountNotAllowedError[source]
Bases:
BaseCurrencyErrorNegative Amount Not Allowed Error
- class pycountries.Phone[source]
Bases:
Enum- AD = 376
- AE = 971
- AF = 93
- AG = 1
- AI = 1
- AL = 355
- AM = 374
- AO = 244
- AR = 54
- AS = 1
- AT = 43
- AU = 61
- AW = 297
- AX = 358
- AZ = 994
- BA = 387
- BB = 1
- BD = 880
- BE = 32
- BF = 226
- BG = 359
- BH = 973
- BI = 257
- BJ = 229
- BL = 590
- BM = 1
- BN = 673
- BO = 591
- BQ = 599
- BR = 55
- BS = 1
- BT = 975
- BW = 267
- BY = 375
- BZ = 501
- CA = 1
- CC = 61
- CD = 243
- CF = 236
- CG = 242
- CH = 41
- CI = 225
- CK = 682
- CL = 56
- CM = 237
- CN = 86
- CO = 57
- CR = 506
- CU = 53
- CV = 238
- CW = 599
- CX = 61
- CY = 357
- CZ = 420
- DE = 49
- DJ = 253
- DK = 45
- DM = 1
- DO = 1
- DZ = 213
- EC = 593
- EE = 372
- EG = 20
- EH = 212
- ER = 291
- ES = 34
- ET = 251
- FI = 358
- FJ = 679
- FK = 500
- FM = 691
- FO = 298
- FR = 33
- GA = 241
- GB = 44
- GD = 1
- GE = 995
- GF = 594
- GG = 44
- GH = 233
- GI = 350
- GL = 299
- GM = 220
- GN = 224
- GP = 590
- GQ = 240
- GR = 30
- GT = 502
- GU = 1
- GW = 245
- GY = 592
- HK = 852
- HN = 504
- HR = 385
- HT = 509
- HU = 36
- ID = 62
- IE = 353
- IL = 972
- IM = 44
- IN = 91
- IO = 246
- IQ = 964
- IR = 98
- IS = 354
- IT = 39
- JE = 44
- JM = 1
- JO = 962
- JP = 81
- KE = 254
- KG = 996
- KH = 855
- KI = 686
- KM = 269
- KN = 1
- KP = 850
- KR = 82
- KW = 965
- KY = 1
- KZ = 7
- LA = 856
- LB = 961
- LC = 1
- LI = 423
- LK = 94
- LR = 231
- LS = 266
- LT = 370
- LU = 352
- LV = 371
- LY = 218
- MA = 212
- MC = 377
- MD = 373
- ME = 382
- MF = 590
- MG = 261
- MH = 692
- MK = 389
- ML = 223
- MM = 95
- MN = 976
- MO = 853
- MP = 1
- MQ = 596
- MR = 222
- MS = 1
- MT = 356
- MU = 230
- MV = 960
- MW = 265
- MX = 52
- MY = 60
- MZ = 258
- NA = 264
- NC = 687
- NE = 227
- NF = 672
- NG = 234
- NI = 505
- NL = 31
- NO = 47
- NP = 977
- NR = 674
- NU = 683
- NZ = 64
- OM = 968
- PA = 507
- PE = 51
- PF = 689
- PG = 675
- PH = 63
- PK = 92
- PL = 48
- PM = 508
- PN = 870
- PR = 1
- PS = 970
- PT = 351
- PW = 680
- PY = 595
- QA = 974
- RE = 262
- RO = 40
- RS = 381
- RU = 7
- RW = 250
- SA = 966
- SB = 677
- SC = 248
- SD = 249
- SE = 46
- SG = 65
- SH = 290
- SI = 386
- SJ = 47
- SK = 421
- SL = 232
- SM = 378
- SN = 221
- SO = 252
- SR = 597
- SS = 211
- ST = 239
- SV = 503
- SX = 599
- SY = 963
- SZ = 268
- TC = 1
- TD = 235
- TG = 228
- TH = 66
- TJ = 992
- TK = 690
- TL = 670
- TM = 993
- TN = 216
- TO = 676
- TR = 90
- TT = 1
- TV = 688
- TW = 886
- TZ = 255
- UA = 380
- UG = 256
- UM = 1
- US = 1
- UY = 598
- UZ = 998
- VA = 379
- VC = 1
- VE = 58
- VG = 1
- VI = 1
- VN = 84
- VU = 678
- WF = 681
- WS = 685
- YE = 967
- YT = 262
- ZA = 27
- ZM = 260
- ZW = 263
- property calling_code: int
Returns: int: International calling code.
- property prefixes: list[int]
- property value: int
Returns: ISO 3166-1 Alpha 2 code.
- exception pycountries.WrongAmountDigitsNumberError[source]
Bases:
BaseCurrencyErrorWrong Amount Digits Number Error.
- exception pycountries.WrongAmountTypeError[source]
Bases:
BaseCurrencyErrorWrong Amount Type Error
- exception pycountries.ZeroAmountNotAllowedError[source]
Bases:
BaseCurrencyErrorZero Amount Not Allowed Error