About 393,000 results
Open links in new tab
  1. How do I get the number of elements in a list (length of a list) in Python?

    Nov 11, 2009 · Explanation Everything in Python is an object, including lists. All objects have a header of some sort in the C implementation. Lists and other similar builtin objects with a "size" in Python, in …

  2. How do I count the occurrences of a list item? - Stack Overflow

    Apr 8, 2010 · 2220 Given a single item, how do I count occurrences of it in a list, in Python? A related but different problem is counting occurrences of each different element in a collection, getting a …

  3. Python - Count elements in list - Stack Overflow

    Nov 9, 2010 · I am trying to find a simple way of getting a count of the number of elements in a list: MyList = ["a", "b", "c"] I want to know there are 3 elements in this list.

  4. How to count the frequency of the elements in an unordered list?

    118 Python 2.7+ introduces Dictionary Comprehension. Building the dictionary from the list will get you the count as well as get rid of duplicates.

  5. python - Using a dictionary to count the items in a list - Stack Overflow

    Sep 12, 2019 · If you are only interested in counting instances of a single element in a list, see How do I count the occurrences of a list item?.

  6. python - How do I count occurrence of unique values inside a list ...

    Sep 5, 2012 · So I'm trying to make this program that will ask the user for input and store the values in an array / list. Then when a blank line is entered it will tell the user how many of those values are …

  7. Python: count repeated elements in the list - Stack Overflow

    Apr 23, 2014 · Closed 3 years ago. I am new to Python. I am trying to find a simple way of getting a count of the number of elements repeated in a list e.g.

  8. Python: count number of elements in list for if condition

    Python: count number of elements in list for if condition Asked 9 years, 9 months ago Modified 9 years, 9 months ago Viewed 9k times

  9. Fastest way to count number of occurrences in a Python list

    Sep 17, 2012 · By the use of Counter dictionary counting the occurrences of all element as well as most common element in python list with its occurrence value in most efficient way.

  10. Python Count Elements in a List of Objects with Matching Attributes

    Nov 24, 2016 · Python Count Elements in a List of Objects with Matching Attributes Asked 12 years, 7 months ago Modified 9 years ago Viewed 91k times