stdnum.es.nie

NIE (Número de Identificación de Extranjeros, Spanish foreigner number).

The NIE is an identification number for foreigners. It is a 9 digit number where the first digit is either X, Y or Z and last digit is a checksum letter.

>>> compact('x-2482300w')
'X2482300W'
>>> is_valid('x-2482300w')
True
>>> is_valid('x-2482300a')  # invalid check digit
False
stdnum.es.nie.compact(number)

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

stdnum.es.nie.is_valid(number)

Checks to see if the number provided is a valid DNI number. This checks the length, formatting and check digit.

Previous topic

stdnum.es.dni

Next topic

stdnum.es.nif