stdnum.no.orgnr

Orgnr (Organisasjonsnummer, Norwegian organisation number).

The Organisasjonsnummer is a 9-digit number with a straightforward check mechanism.

More information:

>>> validate('988 077 917')
'988077917'
>>> validate('988 077 918')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> format('988077917')
'988 077 917'
stdnum.no.orgnr.checksum(number: str) int

Calculate the checksum.

stdnum.no.orgnr.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.orgnr.format(number: str) str

Reformat the number to the standard presentation format.

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

Check if the number is a valid organisation number.

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

Check if the number is a valid organisation number. This checks the length, formatting and check digit.