feat: added examples_tutorials

This commit is contained in:
xpk
2025-11-26 23:20:41 +08:00
parent 96ef5cb42e
commit 9d044c20c9
16 changed files with 201 additions and 70 deletions
+26
View File
@@ -0,0 +1,26 @@
#!/usr/bin/env python3
"""
Demonstrate how to use asyncio
"""
# Imports
import asyncio
async def doit():
print('Start doing...')
await asyncio.sleep(2)
print('Done!')
# Main function
async def main() -> None:
print('Main starts...')
job_queue = []
for i in range(3):
job_queue.append(doit())
await asyncio.gather(*job_queue)
print('Main ends...')
# Call main function
if __name__ == '__main__':
asyncio.run(main())