stdnum.iban¶
IBAN (International Bank Account Number).
The IBAN is used to identify bank accounts across national borders. The first two letters are a country code. The next two digits are check digits for the ISO 7064 Mod 97, 10 checksum. Each country uses its own format for the remainder of the number.
Some countries may also use checksum algorithms within their number but this is only checked for a few countries.
More information:
https://en.wikipedia.org/wiki/International_Bank_Account_Number
https://www.swift.com/products_services/bic_and_iban_format_registration_iban_format_r
>>> validate('GR16 0110 1050 0000 1054 7023 795')
'GR1601101050000010547023795'
>>> validate('BE31435411161155')
'BE31435411161155'
>>> compact('GR16 0110 1050 0000 1054 7023 795')
'GR1601101050000010547023795'
>>> format('GR1601101050000010547023795')
'GR16 0110 1050 0000 1054 7023 795'
>>> calc_check_digits('BExx435411161155')
'31'
- stdnum.iban.calc_check_digits(number)¶
Calculate the check digits that should be put in the number to make it valid. Check digits in the supplied number are ignored.
- stdnum.iban.compact(number)¶
Convert the iban number to the minimal representation. This strips the number of any valid separators and removes surrounding whitespace.
- stdnum.iban.format(number, separator=' ')¶
Reformat the passed number to the space-separated format.
- stdnum.iban.is_valid(number, check_country=True)¶
Check if the number provided is a valid IBAN.
- stdnum.iban.validate(number, check_country=True)¶
Check if the number provided is a valid IBAN. The country-specific check can be disabled with the check_country argument.