stdnum.no.kontonr

Konto nr. (Norwegian bank account number)

Konto nr. is the country-specific part in Norwegian IBAN codes. The number consists of 11 digits, the first 4 are the bank identifier and the last is a check digit. This module does not check if the bank identifier exists.

More information:

>>> validate('8601 11 17947')
'86011117947'
>>> validate('0000.4090403')  # postgiro bank code
'4090403'
>>> validate('8601 11 17949')  # invalid check digits
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> format('86011117947')
'8601.11.17947'
>>> to_iban('8601 11 17947')
'NO93 8601 11 17947'
stdnum.no.kontonr.compact(number: str) str

Convert the number to the minimal representation. This strips the number of any valid separators and removes surrounding whitespace.

stdnum.no.kontonr.format(number: str) str

Reformat the number to the standard presentation format.

stdnum.no.kontonr.is_valid(number: str) bool

Check if the number provided is a valid bank account number.

stdnum.no.kontonr.to_iban(number: str) str

Convert the number to an IBAN.

stdnum.no.kontonr.validate(number: str) str

Check if the number provided is a valid bank account number.