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:]

打赏 赞(0)
微信
支付宝
微信二维码图片

微信扫描二维码打赏

支付宝二维码图片

支付宝扫描二维码打赏

发表评论

您的电子邮件地址将不会发布。