The len()
function can be used with several different types in Python – both built-in types and library types. For example:
>>> len([1, 2, 3])
3
More Related Contents:
- Printing the number from a list and its square on the same line in python3 [closed]
- How to reverse a list?
- How does assignment work with list slices?
- Why does Python skip elements when I modify a list while iterating over it?
- Count frequency of words in a list and sort by frequency
- Can’t modify list elements in a loop [duplicate]
- How do I make a flat list out of a list of lists?
- How to efficiently compare two unordered lists (not sets)?
- Different ways of clearing lists
- How to get item’s position in a list?
- Add list to set
- How to find the min/max value of a common key in a list of dicts?
- Converting a list of tuples into a dict
- str.startswith with a list of strings to test for
- Python Array Slice With Comma?
- How to split strings inside a list by whitespace characters
- Complexity of list.index(x) in Python
- How to transform string of space-separated key,value pairs of unique words into a dict
- Nested list comprehensions
- Python range() and zip() object type
- Python: find closest string (from a list) to another string
- How to override the slice functionality of list in its derived class
- Index all *except* one item in python
- How to convert a string with comma-delimited items to a list in Python?
- Python and SQLite: insert into table
- How to zip two lists of lists
- How to create a number of empty nested lists in python [duplicate]
- How can I sort a list, according to where its elements appear in another list?
- How can I turn a flat list into a 2D array in python?
- Size of a Python list in memory