/ Published in: Python
URL: http://www.codigopython.com.ar/
Validar el numero de CUIT usando la forma '00-00000000-0'
Visto en: http://python.org.ar/pyar/Recetario/ValidarCuit
Expand |
Embed | Plain Text
def esCUITValida(cuit): # validaciones minimas if len(cuit) != 13 or cuit[2] != "-" or cuit[11] != "-": return False base = [5, 4, 3, 2, 7, 6, 5, 4, 3, 2] cuit = cuit.replace("-", "") # remuevo las barras # calculo el digito verificador: aux = 0 for i in xrange(10): aux += int(cuit[i]) * base[i] aux = 11 - (aux - (int(aux / 11) * 11)) if aux == 11: aux = 0 if aux == 10: aux = 9 return aux == int(cuit[10])
You need to login to post a comment.
