Package for validating Chilean RUT
Project description
rut-chile
Python module that provides common functionality regarding Chilean RUT
Installation
pip install rut_chile
or
git clone https://github.com/gevalenz/rut-chile.git
python setup.py install
Usage
Validate RUT
from rut_chile import rut_chile
rut_chile.is_valid_rut("12345678-9")
# returns False
rut_chile.is_valid_rut("6265837-1")
# returns True
# It works with the following formats
rut_chile.is_valid_rut("98685030")
# returns True
rut_chile.is_valid_rut("9868503-0")
# returns True
rut_chile.is_valid_rut("9.868.503-0")
# returns True
rut_chile.is_valid_rut("12.667.869-K")
# returns True
rut_chile.is_valid_rut("12.667.869-k")
# returns True
Get verification digit
from rut_chile import rut_chile
rut_chile.get_verification_digit("9868503")
# returns "0"
rut_chile.get_verification_digit("12667869")
# returns "k"
rut_chile.get_capitalized_verification_digit("12667869")
# returns "K"
Format RUT
from rut_chile import rut_chile
rut_chile.format_rut_with_dots("12667869k")
# returns "12.667.869-k"
rut_chile.format_rut_without_dots("12667869k")
# returns "12667869-k"
rut_chile.format_capitalized_rut_without_dots("12667869k")
# returns "12667869-K"
rut_chile.format_capitalized_rut_with_dots("12667869k")
# returns "12.667.869-K"
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
rut_chile-2.0.0.tar.gz
(3.4 kB
view hashes)
Built Distributions
rut_chile-2.0.0-py3.6.egg
(5.6 kB
view hashes)
Close
Hashes for rut_chile-2.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82c5eebb89e9b4b6c6708157aacbfa83c86b0bcf381305f7bd7cc52f5cc93f74 |
|
MD5 | d8913c44ad4a47ebfd3bdd75e272a1fb |
|
BLAKE2b-256 | a21b8b8c4b9064a1d9ff5adc5be9cbcbee191c0b228ce94d85502c0e3729c35c |