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:
>>> 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)¶
Convert the number to the minimal representation. This strips the number of any valid separators and removes surrounding whitespace.
- stdnum.se.postnummer.format(number)¶
Reformat the number to the standard presentation format.
- stdnum.se.postnummer.is_valid(number)¶
Check if the number is a valid postal code.
- stdnum.se.postnummer.validate(number)¶
Check if the number is in the correct format. This currently does not check whether the code corresponds to a real address.