from gevent import monkey;
monkey.patch_all()
import gevent
from urllib import requestdef get_url(url):
ret = request.urlopen(url)
content = ret.read().decode("UTF-8")
return len(content)url_list = [
"http://www.baidu.com",
"http://www.jcgzsstudio.com",
"http://www.hao123.com"
]g_list = []
for url in url_list:
g = gevent.spawn(get_url, url)
g_list.append(g)
gevent.joinall(g_list)
for g in g_list:
print(g.value)