stdnum.at.postleitzahl

Postleitzahl (Austrian postal code).

The Austrian postal code consists of four digits that identifies a post office in Austria.

More information:

>>> validate('5090')
'5090'
>>> import json
>>> print(json.dumps(info('5090'), indent=2, sort_keys=True))
{
  "location": "Lofer",
  "region": "Salzburg"
}
>>> validate('4231')  # not-existing postal code
Traceback (most recent call last):
    ...
InvalidComponent: ...
>>> validate('ABCD')
Traceback (most recent call last):
    ...
InvalidFormat: ...
stdnum.at.postleitzahl.compact(number: str) str

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

stdnum.at.postleitzahl.info(number: str) dict[str, str]

Return a dictionary of data about the supplied number. This typically returns the location.

stdnum.at.postleitzahl.is_valid(number: str) bool

Check if the number is a valid postal code.

stdnum.at.postleitzahl.validate(number: str) str

Check if the number is a valid postal code.