我想终端输出值千言万语
[~] $ 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
在Python3.5中添加了
async
关键字。在在python3.5中引入了}语法。(https://docs.python.org/3/reference/compound_stmts.html#coroutines)
async
和{在Python3.4中,您需要使用
@asyncio.coroutine
修饰符和yield from
语法。(https://docs.python.org/3.4/library/asyncio-task.html#coroutines)相关问题 更多 >
编程相关推荐