stdnum.nl.postcode

Postcode (the Dutch postal code).

The Dutch postal code consists of four numbers followed by two letters, separated by a single space.

More information: * https://en.wikipedia.org/wiki/Postal_codes_in_the_Netherlands * https://nl.wikipedia.org/wiki/Postcodes_in_Nederland

>>> validate('2601 DC')
'2601 DC'
>>> validate('NL-2611ET')
'2611 ET'
>>> validate('26112 ET')
Traceback (most recent call last):
    ...
InvalidFormat: ...
>>> validate('2611 SS')  # a few letter combinations are banned
Traceback (most recent call last):
    ...
InvalidComponent: ...
stdnum.nl.postcode.compact(number)

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

stdnum.nl.postcode.is_valid(number)

Check if the number is a valid postal code.

stdnum.nl.postcode.validate(number)

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