Skip to content

Instantly share code, notes, and snippets.

@Mufanc
Last active October 2, 2021 14:26
Show Gist options
  • Save Mufanc/a4f346c2e684dc7628e8206b1875c881 to your computer and use it in GitHub Desktop.
Save Mufanc/a4f346c2e684dc7628e8206b1875c881 to your computer and use it in GitHub Desktop.
[Python 异步 IO ainput 实现] #Python
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