stdnum.cl.rut

RUT (Rol Único Tributario, Chilean national tax number).

The RUT, the Chilean national tax number is the same as the RUN (Rol Único Nacional) the Chilean national identification number. The number consists of 8 digits, followed by a check digit.

>>> validate('76086428-5')
'760864285'
>>> validate('CL 12531909-2')
'125319092'
>>> validate('12531909-3')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> validate('76086A28-5')
Traceback (most recent call last):
    ...
InvalidFormat: ...
>>> format('125319092')
'12.531.909-2'
stdnum.cl.rut.calc_check_digit(number)

Calculate the check digit. The number passed should not have the check digit included.

stdnum.cl.rut.compact(number)

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

stdnum.cl.rut.format(number)

Reformat the number to the standard presentation format.

stdnum.cl.rut.is_valid(number)

Check if the number is a valid RUT.

stdnum.cl.rut.validate(number)

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