【问题标题】:Why keyword.kwlist doesn't contain 'async' and 'await'?为什么keyword.kwlist不包含'async'和'await'?
【发布时间】:2019-02-21 09:25:41
【问题描述】:

我有 Python3.6 和像 async def foo(): pass 这样的函数可以完美运行,但我有这个输出:

$ python
Python 3.6.7 (default, Oct 22 2018, 11:32:17) 
>>> import keyword
>>> 'async' in keyword.kwlist
False
>>> 'await' in keyword.kwlist
False

我的 Python 或其模块 keyword 有什么问题?

【问题讨论】:

标签: python python-3.x keyword


【解决方案1】:

您的 python 安装没有问题,它只是 3.6 版。

asyncawait 只是自Python 3.7 以来的正确关键字,正如PEP 492 中所计划的那样。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-10-26
    • 2020-01-24
    • 2012-08-27
    • 1970-01-01
    • 1970-01-01
    • 2021-08-25
    • 2021-10-09
    相关资源
    最近更新 更多