Sometimes, we want to print list items with Python.
In this article, we’ll look at how to print list items with Python.
How to print list items with Python?
To print list items with Python, we can call print
with the sep
argument set to separator string to separate each item being printed.
For instance, we write
print(*my_list, sep='\n')
to print all the items in my_list
separated by a new line character.
We use *
to unpack the items in my_list
list as arguments.
Conclusion
To print list items with Python, we can call print
with the sep
argument set to separator string to separate each item being printed.