Home > Backend Development > Python Tutorial > What does len mean in python?

What does len mean in python?

silencement
Release: 2019-06-25 15:09:47
Original
10391 people have browsed it

What does len mean in python?

The len() method in python

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

Syntax

len() method syntax:

len( s )
Copy after login

Parameters

s -- Object.

Return value

Return the length of the object.

Example

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

The above is the detailed content of What does len mean in python?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
len
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template