Async çağrı fonksiyonu

Kod örnekleri

0
0

# async bekleme fonksiyonu

# async await function
import asyncio
import time
async def sleep_6():
  time.sleep(5)
  print('5 done')
  time.sleep(3)
  print('3 done')
  
async def sleep_8():
  await asyncio.sleep(7)
  print('8 done')

async def gather_fxn():
  await asyncio.gather(sleep_6(), sleep_8())

loop=asyncio.new_event_loop()
loop=loop.run_until_complete(gather_fxn())
loop.close()

# output:
# 5 done
# 3 done
# 8 done

İlgili sayfalar

Örneklerle ilgili sayfalar

Diğer dillerde

Bu sayfa diğer dillerde

Русский
..................................................................................................................
English
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................