Skip to content

dahlia/iso4217

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

iso4217: Currency data package for Python

https://badge.fury.io/py/iso4217.svg?

This Python package contains ISO 4217 currency data, represented as enum module which was introduced in 3.4.

>>> from iso4217 import Currency
>>> Currency.USD
<Currency.USD: 'USD'>
>>> Currency.USD.code
'USD'
>>> Currency.USD.currency_name
'US Dollar'
>>> Currency.USD.exponent  # USD has cents
2
>>> Currency.JPY
<Currency.JPY: 'JPY'>
>>> Currency.JPY.currency_name
'Yen'
>>> Currency.JPY.exponent  # JPY has no minor units
0
>>> Currency('KRW')  # Get by the code string
<Currency.KRW: 'KRW'>
>>> Currency.KRW is Currency('KRW')
True
>>> Currency.krw is Currency.KRW  # Lower enumerants are also available

Written by Hong Minhee. Distributed under Public Domain.