python. Asyncio. Asynchronous reading and recording of the file
question@mail.ru
·
01.01.1970 03:00
Python. Asyncio. Asynchronous reading and recording file
answer@mail.ru
·
01.01.1970 03:00
asynchronously, but you can in executor.
import asyncior def read_file ( file_name ): retu open (file_name) .Read () async def mail (): loop = asyncio.get_event_loop () data = await loop.ru_in_in_executor ( non , read_file, 'Data.txt' ) print (data) loop = asyncio.get_event_loop () loop.ru_Until_complete (Main ())