What is the Most Efficient Way of Printing A Dict's Contents Out In Columns?

MRAB python at mrabarnett.plus.com
Tue Jun 14 14:37:27 EDT 2011


On 14/06/2011 18:48, Zach Dziura wrote:
[snip]
> I just have one quick question. On the line where you have zip(*arr),
> what is the * for? Is it like the pointer operator, such as with C? Or
> is it exactly the pointer operator?
>
[snip]
The * in the argument list of a function call unpacks the following
list as arguments for the call, for example, zip(*[0, 1, 2]) becomes
zip(0, 1, 2), so zip(*arr) becomes zip(arr[0], arr[1], ...).

There's also **, which unpacks a dict as keyword arguments.



More information about the Python-list mailing list