Skip to content

Instantly share code, notes, and snippets.

@hector117
Created March 9, 2017 16:10
Show Gist options
  • Save hector117/69673e933689e8a6a09a482427bb707b to your computer and use it in GitHub Desktop.
Save hector117/69673e933689e8a6a09a482427bb707b to your computer and use it in GitHub Desktop.
def contador(nombre):
# direccion = '/Users/Hector Santillan/Desktop/python/' + nombre
direccion = nombre
abierto = open(direccion,'r')
texto = abierto.read()
lista = len(texto.split("\n"))
tupla = (lista,len(texto))
abierto.close()
return tupla
#main program below
print("WSQ-09")
nombre = input("Ingresa el nombre del archivo")
a = contador(nombre)[0]
b = contador(nombre)[1]
print("El numero de caracteres es de %1d y hay %1d lineas " % (b,a))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment