There are many ways to display all list elements in Python, but the easiest way is to use variadic arguments if you just want to display them without any processing.
The following source code is supposed to be executed in Python 3
words = ["new", "Rice", "President"]
print(*words)
New US President
By default, it is output separated by spaces, and a line break is performed at the end.
By specifying sep for print, it can be separated by any character. If you do not need a delimiter, specify an empty string.
words = ["new", "Rice", "President"]
print(*words, sep=",")
new,Rice,President
words = ["new", "Rice", "President"]
print(*words, sep="")
New President
Recommended Posts