# -*- coding: utf-8 -*- import asyncio async def wget(host): print('wget %s...' % host) connect = asyncio.open_connection(host, 80) await connect print('偷懒。。。') loop = asyncio.get_event_loop() tasks = [wget(host) for host in ['www.sina.com.cn', 'www.sohu.com', 'www.163.com']] loop.run_until_complete(asyncio.wait(tasks)) loop.close()
Sign in to make a reply
明日复明日-90后