stdnum.se.orgnr

Orgnr (Organisationsnummer, Swedish company number).

The Orgnr (Organisationsnummer) is the national number to identify Swedish companies and consists of 10 digits. These are the first 10 digits in the Swedish VAT number, i.e. it’s the VAT number without the ‘SE’ in front and the ‘01’ at the end.

>>> validate('1234567897')
'1234567897'
>>> validate('1234567891')  # invalid check digits
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> format('123456-7897')
'123456-7897'
stdnum.se.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.se.orgnr.format(number: str) str

Reformat the number to the standard presentation format.

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

Check if the number is a valid organisation number

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

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