Home  >  Article  >  Backend Development  >  How to output a list in python

How to output a list in python

藏色散人
藏色散人Original
2019-10-18 11:39:2912500browse

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'].

How to output a list in python

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn