3

I have a list of names and I want to print each element of the list in a different line without a for loop. So, after some research I found this example: print(*names, sep='\n'), witch results in exactly what I want. But what does this * character before the list name means?

flpn
  • 1,718
  • 2
  • 15
  • 29

1 Answers1

4

The * is used to unpack argument lists when calling a function. In this case it unpacks your list of names.

Cary Shindell
  • 1,296
  • 6
  • 25