Difference between revisions of "Await"

From wikieduonline
Jump to navigation Jump to search
Line 5: Line 5:
 
[[Python 3.5]] has added support for async/await as described in PEP 492 (https://www.python.org/dev/peps/pep-0492/).
 
[[Python 3.5]] has added support for async/await as described in PEP 492 (https://www.python.org/dev/peps/pep-0492/).
  
<code>
+
<pre>
 
import asyncio
 
import asyncio
  
Line 14: Line 14:
  
 
asyncio.run(main())
 
asyncio.run(main())
</code>
+
</pre>
 
 
  
 
== See also ==
 
== See also ==

Revision as of 11:21, 10 August 2021

wikipedia:Await


In Python

Python 3.5 has added support for async/await as described in PEP 492 (https://www.python.org/dev/peps/pep-0492/).

import asyncio

async def main():
    print("hello")
    await asyncio.sleep(1)
    print("world")

asyncio.run(main())

See also

Advertising: