python 2.7 does not support star expression

python 3 support star expression, but python 2.7 does NOT support star expression.

here is a example:

in python 3

>>> a, *b = (1, 2, 3)
>>> b
[2, 3]
>>> a, *b = (1,)
>>> b
[]

in python 2.7, you should do this instead:


c = (1, 2, 3)
a, b = c[0], c[1:]

本站提供的服务

发表评论

电子邮件地址不会被公开。 必填项已用*标注