Skip to content

Instantly share code, notes, and snippets.

@jorgebastida
Last active October 4, 2015 10:38
Show Gist options
  • Select an option

  • Save jorgebastida/2622601 to your computer and use it in GitHub Desktop.

Select an option

Save jorgebastida/2622601 to your computer and use it in GitHub Desktop.
enjoydjango - Ejercicio Resuelto
#!/usr/bin/env python
import urllib2
URL = "https://gist.github.com/jorgebastida/2622704/raw/b264cf36cace951cd1ab32c1a783c0c26ff28545/trash.txt"
def es_digito(num):
return num in "0123456789"
cadena = urllib2.urlopen(URL).read()
cadena = filter(es_digito, cadena)
digitos = map(int, cadena)
print sum(digitos)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment