Using the aiofiles:
async with aiofiles.open('filename', mode="r") as f: async for line in f: print(line)
As the @Jashandeep mentioned, you should care about blocking operations:
Another method is
select and or
from select import select files_to_read, files_to_write, exceptions = select([f1, f2], [f1, f2], [f1, f2], timeout=.1)
timeout parameter is important here.
You can register a file for read/write with: loop.add_reader()
It uses internal EPOLL Handler inside the loop.
But remember the Epoll will not work with regular files.