+ 7
ZIP function in python
I have seen a piece of code somewhere and i don't understand the function of "*" in a line. The line was like this : List = [ list (x) for x in zip (*my_list)] my_list here is a 2-D list Help me plz
5 Respuestas
+ 6
* takes the list's elements, and kind of "joins" them. For string lists, it's like "".join(list).
+ 5
can you give an example ....
+ 5
ls = ["a", "b", "c"]
print(*ls)
OUTPUT:
abc
+ 2
The zip() function take iterables (can be zero or more), makes iterator that aggregates elements based on the iterables passed, and returns an iterator of tuples.