终端输出值一千字,我猜
[~] $ python
Python 3.4.3 (default, Jun 22 2016, 16:03:29)
[GCC 4.9.3] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import asyncio
>>> async def fun():
File "<stdin>", line 1
async def fun():
^
SyntaxError: invalid syntax
最佳答案
async
和 await
语法是在 Python 3.5 中引入的。 ( https://docs.python.org/3/reference/compound_stmts.html#coroutines )
在 Python 3.4 中,您需要使用 @asyncio.coroutine
装饰器和 yield from
语法。 ( https://docs.python.org/3.4/library/asyncio-task.html#coroutines )
关于Python 3.4.3 asyncio 关键字 SyntaxError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38270559/