Skip to content

Instantly share code, notes, and snippets.

@Jul10l1r4
Last active December 31, 2018 19:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Jul10l1r4/1fd4ad230f82ce4c28a493ee5c72dbb9 to your computer and use it in GitHub Desktop.
Save Jul10l1r4/1fd4ad230f82ce4c28a493ee5c72dbb9 to your computer and use it in GitHub Desktop.
Cria varias requisições, sem definir temo, e bloqueante
import urllib2
import time
# lista a ser percorrida
urls = [
'https://www.google.com',
'http://www.python.org/about/',
'https://jul10l1r4.github.io',
'https://facebook.com',
'https://twitter.com',
'https://youtube.com',
'https://wikipedia.org',
'https://wiki.python.org/',
]
# Funcao que percorrera
def func (x):
print "\033[32m"+x+"\033[0m"
urllib2.urlopen(x)
# Usando o "map" para percorrer a lista com as funcoes
results = map(func, urls)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment