Skip to content

Instantly share code, notes, and snippets.

View knxroot's full-sized avatar

Gustavo Lacoste knxroot

View GitHub Profile
@knxroot
knxroot / rut-flask-restful-validation
Last active August 29, 2015 14:26 — forked from rbonvall/rut.py
Dígito verificador del RUT en Python
# encoding=utf-8
# Idea of a Custom data types for validate the Chilean RUT in Flask-RESTful
# by @lacosox
from itertools import cycle
#rut='XXXXXXXX-X'
def chilean_rut(rut_text):
rut_text.upper().strip().replace(".", "").replace("K", "10")
(rut, dv)=rut_text.split('-')