stdnum.es.postal_code¶
Postcode (the Spanish postal code).
The Spanish postal code consists of five digits where the first two digits, ranging 01 to 52, correspond either to one of the 50 provinces of Spain or to one of the two autonomous cities on the African coast.
More information:
>>> validate('01000')
'01000'
>>> validate('52000')
'52000'
>>> validate('00000')
Traceback (most recent call last):
...
InvalidComponent: ...
>>> validate('53000')
Traceback (most recent call last):
...
InvalidComponent: ...
>>> validate('99999')
Traceback (most recent call last):
...
InvalidComponent: ...
>>> validate('5200')
Traceback (most recent call last):
...
InvalidLength: ...
>>> validate('520000')
Traceback (most recent call last):
...
InvalidLength: ...
- stdnum.es.postal_code.compact(number)¶
Convert the number to the minimal representation.
- stdnum.es.postal_code.is_valid(number)¶
Check if the number provided is a valid postal code.
- stdnum.es.postal_code.validate(number)¶
Check if the number provided is a valid postal code.