# stdnum.se.postnummer

Postcode (the Swedish postal code).

The Swedish postal code consists of three numbers followed by two numbers, separated by a single space.

More information:

- https://en.wikipedia.org/wiki/Postal_codes_in_Sweden

- https://sv.wikipedia.org/wiki/Postnummer_i_Sverige

    >>> validate('114 18')
    '11418'
    >>> validate('SE-11418')
    '11418'
    >>> validate('1145 18')
    Traceback (most recent call last):
        ...
    InvalidLength: ...
    >>> format('11418')
    '114 18'

stdnum.se.postnummer.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.postnummer.format(number: str) → str

  Reformat the number to the standard presentation format.

stdnum.se.postnummer.is_valid(number: str) → bool

  Check if the number is a valid postal code.

stdnum.se.postnummer.validate(number: str) → str

  Check if the number is in the correct format. This currently does not check whether the code corresponds to a real address.