简体   繁体   中英

Create async task from sync method in python

There is a method In C# Task.Run that accepts delegate as parameter and returns task that can be awaited.

Is there such thing in Python asyncio?

I need to wrap a sync block of code to async task.

There is something like this in Python

Python docs. for ex: https://docs.python.org/3/library/asyncio.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM