Home > Article > Backend Development > How to output a list in python
How does python output a list?
Just use the print function directly. For example:
L=['apple','fruit']#定义一个列表 print(L)#输出一个列表
Recommended: "Python Tutorial"
The output result is [ 'apple','fruit'].
Extended information:
Print without an output item outputs a blank line. If the output item of the previous print statement ends with something like " ," or ";" means that the output is on the same line. The empty print statement after it is used to eliminate the effect of the previous print statement always outputting on the same line, so that the subsequent output is on the next line.
The above is the detailed content of How to output a list in python. For more information, please follow other related articles on the PHP Chinese website!