stdnum.il.idnr

Identity Number (Mispar Zehut, מספר זהות, Israeli identity number).

The identity number (Mispar Zehut, מספר זהות) is issued at birth to Israeli citizens. The number consists of nine digits and includes a check digit.

More information:

>>> validate('3933742-3')
'039337423'
>>> format('39337423')
'03933742-3'
>>> validate('3933742-2')  # invalid check digit
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> validate('490154203237518')  # longer than 9 digits
Traceback (most recent call last):
    ...
InvalidLength: ...
stdnum.il.idnr.compact(number: str) str

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

stdnum.il.idnr.format(number: str) str

Reformat the number to the standard presentation format.

stdnum.il.idnr.is_valid(number: str) bool

Check if the number provided is a valid ID. This checks the length, formatting and check digit.

stdnum.il.idnr.validate(number: str) str

Check if the number provided is a valid ID. This checks the length, formatting and check digit.