Home  >  Article  >  Backend Development  >  What does python len mean?

What does python len mean?

藏色散人
藏色散人Original
2019-06-22 10:40:5910531browse

What does python len mean?

What does python len mean?

Python len() method returns the length or number of items of an object (character, list, tuple, etc.).

len() method syntax:

len( s )

Parameters

s -- Object.

Return value

Return the length of the object.

The following example shows how to use len():

>>>str = "runoob"
>>> len(str)             # 字符串长度
6
>>> l = [1,2,3,4,5]
>>> len(l)               # 列表元素个数
5

Related recommendations: "Python Tutorial"

The above is the detailed content of What does python len mean?. 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
Previous article:what is enum pythonNext article:what is enum python