what does * do when unzipping a python list?
This question already has an answer here:
With this:
zip(*zipped)
you tell python the same as this:
zip(zipped[0],zipped[1],zipped[2])
for this basic example.
What does exactly that operator
When used as argument of a function, it takes the elements of the argument and expand it before passing as argument.
For instance:
power = [2,3]
math.pow(*power)
Would give you the value of 2³ = 8.
http://ideone.com/D0R9FB
链接地址: http://www.djcxy.com/p/53642.html上一篇: 使用星号(*)运算符遍历2D列表
下一篇: *解压缩python列表时会做些什么?