A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.w3schools.com/python/ref_func_len.asp below:

Website Navigation


Python len() Function

Python len() Function

❮ Built-in Functions

Example

Return the number of items in a list:

mylist = ["apple", "banana", "cherry"]
x = len(mylist)

Try it Yourself » Definition and Usage

The len() function returns the number of items in an object.

When the object is a string, the len() function returns the number of characters in the string.

Syntax Parameter Values Parameter Description object Required. An object. Must be a sequence or a collection More Examples Example

Return the number of characters in a string:

mylist = "Hello"
x = len(mylist)

Try it Yourself »

❮ Built-in Functions

Track your progress - it's free!


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4