Last active
October 2, 2021 14:26
-
-
Save Mufanc/a4f346c2e684dc7628e8206b1875c881 to your computer and use it in GitHub Desktop.
[Python 异步 IO ainput 实现] #Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async def ainput(prompt: str = ''): | |
with ThreadPoolExecutor(1, 'ainput') as executor: | |
return ( | |
await asyncio.get_event_loop().run_in_executor(executor, input, prompt) | |
).rstrip() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment