ISO 4217 Currency Data
The `iso4217` library provides ISO 4217 currency data for Python, represented as an `enum` module. It offers access to current and historical currency codes, names, and numerical values. The library is actively maintained with version `1.16.20260101` and releases new versions regularly to reflect updates to the ISO 4217 standard, typically indicated by a date-based versioning scheme.
Warnings
- gotcha There are several Python packages with similar names (e.g., `python-iso4217`, `iso_4217`, `iso4217parse`) that provide ISO 4217 data but have distinct APIs and features. Ensure you are using the `iso4217` package by `dahlia` to avoid unexpected behavior or import errors.
- gotcha ISO 4217 currency data is subject to periodic amendments (e.g., currency adoptions, withdrawals). Relying on an outdated version of the `iso4217` package can lead to incorrect or incomplete currency information.
Install
-
pip install iso4217
Imports
- Currency
from iso4217 import Currency
Quickstart
from iso4217 import Currency
# Access a currency by its alpha-3 code
usd = Currency.USD
print(f"USD: {usd.currency_name} ({usd.numeric_code})")
# Access a currency by its numeric code (if enum supports it, or by value)
try:
eur = Currency(978) # Access by numeric value
print(f"EUR: {eur.currency_name} ({eur.alpha_code})")
except ValueError:
# If direct numeric access isn't supported, iterate or use a helper (not in this library)
eur = next((c for c in Currency if c.numeric_code == 978), None)
if eur:
print(f"EUR (found by numeric code): {eur.currency_name} ({eur.alpha_code})")
# Iterate through all active currencies
print("\nAll active currencies:")
for currency in Currency:
print(f"- {currency.alpha_code}: {currency.currency_name}")