列表解包 python 带 *

List unpacking python with *

这是一个非常基本的语法,应该可以工作:

# List Unpacking

numbers = [12, 23, 31, 46, 75, 85, 63, 50, 65, 63, 43, 1, 4, 56, 7, 4]
first, *others = numbers
print(first)

但是我收到了这个错误, 文件 "app.py",第 4 行 首先,*其他 = 数字 ^ 语法错误:语法无效

已 python 删除了此语法,或者我做错了什么。

检查您的 python 版本,additional unpacking generalizations 自 python 3.5

以来已经引入

例如,我有 python 3.7,你的代码运行良好