After python3.5 the async more convenient reading
Using asynchronous IO message loop mode, repeat "read message - the message handling" process, that is to say asynchronous IO model "requires a message loop, in a message loop, the main thread continuously repeating" read message - Message Processing. " this process .
Coroutine: the async functions Function keyword declared () will not be executed immediately, but returns an asynchronous object is used to register
run_until_complete: Hiap Seng simultaneously start the execution list
wait for suspending blocking asynchronous call interface immediately hand over executive power cpu
async DEF Hello (): async asynchronous function defined, the intermediate may be added await async.sleep (N) is set and an interrupt message to the next loop Tasks = [] is the task of further encapsulated coroutine, which contains the various tasks status. I.e., a plurality of functions can be packaged into a coroutine set and concurrently executing Task Loop = asyncio.get_event_loop () # Get "Event Loop" objects loop.run_until_complete (asyncio.wait (Tasks)) # by the event loop, the function to call the coroutine loop. close () loop end time