Home >Backend Development >Python Tutorial >Usage of len() in python

Usage of len() in python

angryTom
angryTomOriginal
2019-07-22 13:39:3134910browse

Usage of len() in python

Recommended tutorial: Python tutorial

Function: len ()

#Return the length of string, list, dictionary, tuple, etc.

Syntax: len(str)

str: ​​String, list, dictionary, tuple, etc. to be calculated

Return value : The length of elements such as strings, lists, dictionaries, and tuples.

Test:

1: Calculate the length of the string

Usage of len() in python

2: Calculate the length of the array

Usage of len() in python

3: Calculate the length of the dictionary

Usage of len() in python

The above is the detailed content of Usage of len() 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