About 149,000 results
Open links in new tab
  1. Size of Python Counter - Stack Overflow

    Jul 28, 2013 · I want to know how many items are in a Python Counter, including the duplicates. I tried len and it tells me the number of unique items: >>> c = Counter(x=3,y=7) >>> len(c) 2

  2. Python's Counter: The Pythonic Way to Count Objects

    When you need to count several repeated objects in Python, you can use Counter from collections. This class provides an efficient and Pythonic way to count things without the need …

  3. Get the size (length, number of items) of a list in Python

    Aug 24, 2023 · In Python, you can get the size (length, number of items) of a list using the built-in len() function. You can get the total number of items using len(). If you want to count the …

  4. Python collections Counter - GeeksforGeeks

    Dec 18, 2024 · The len() function in Python is used to get the number of items in an object. It is most commonly used with strings, lists, tuples, dictionaries and other iterable or container …

  5. Python len() Function - W3Schools

    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. Required. An object. Must be a …

  6. Python - List Length and Count - Includehelp.com

    May 1, 2025 · In Python, you can determine the size of a list using the len() function and count specific elements using the count() method. In this chapter, we will learn how to find the length …

  7. How do I get the length of a list? - Stack Overflow

    Nov 11, 2009 · Return the length (the number of items) of an object. The argument may be a sequence (such as a string, bytes, tuple, list, or range) or a collection (such as a dictionary, …

  8. Explain the difference between ‘len()’ and ‘count()’ in Python.

    Aug 26, 2024 · This article clarifies the distinction between Python's `len()` and `count()` functions, highlighting their respective functionalities, importance in programming, and practical use …

  9. Using the len () Function in Python – Real Python

    Nov 16, 2024 · To find the length of a list in Python, you pass the list to len(), like len([1, 2, 3]). The len() function operates in constant time, O (1), as it accesses a length attribute in most …

  10. Python len(String, Tuple, List, Dictionary, Numbers)

    Well, the len() function is your celestial counter in Python’s universe! Its main purpose is to count and reveal the number of elements within a data structure, providing you with valuable …

  11. Some results have been removed
Refresh