Home  >  Article  >  Backend Development  >  What does the len function in python mean?

What does the len function in python mean?

尚
Original
2019-07-06 11:56:3641170browse

What does the len function in python mean?

len() function:

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

len() method syntax:

len( s )

Parameters: s -- object.

Return value: Return the length of the object.

The following examples show how to use len():

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

For more Python related technical articles, please visit the Python Tutorial column to learn!

The above is the detailed content of What does the len function in python 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