Last active
December 31, 2018 19:04
-
-
Save Jul10l1r4/1fd4ad230f82ce4c28a493ee5c72dbb9 to your computer and use it in GitHub Desktop.
Cria varias requisições, sem definir temo, e bloqueante
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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