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

    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 …

  2. How to get length of nested list in Python - Stack Overflow

    Jun 29, 2022 · How to get length of nested list in Python Asked 3 years, 6 months ago Modified 3 years, 6 months ago Viewed 2k times

  3. python - Get all (n-choose-k) combinations of length n - Stack …

    For combinations of all possible lengths, see Get all possible (2^N) combinations of a list’s elements, of any length . Note that this is not simply a matter of iterating over the possible …

  4. python - Type hint for a Sequence or list with known length

    You can't. A list is a mutable, variable length structure. If you need a fixed-length structure, use a tuple instead:

  5. python - How to find length of a multi-dimensional list ... - Stack ...

    Apr 14, 2013 · 7 How do you find the length of a multi-dimensional list? I've come up with a way myself, but is this the only way to find the number of values in a multi-dimensional list?

  6. How to get length of a list of lists in python - Stack Overflow

    In your code, you have a list of lines (strings). not a list of lists. And python will happily count empty lines... Did you check to make sure you don't have any empty lines?

  7. How Big can a Python List Get? - Stack Overflow

    May 12, 2009 · In Python, how big can a list get? I need a list of about 12000 elements. Will I still be able to run list methods such as sorting, etc?

  8. How to find length of an element in a list? - Stack Overflow

    Oct 23, 2015 · list_of_lengths = (lambda x:[len(i) for i in x])(lst) Longer explanation (from the inner brackets, moving outwards) We loop through our list and get the corresponding length value of …

  9. How to create a fix size list in python? - Stack Overflow

    May 16, 2012 · Actually if you know the length of the list it will be faster to create the "empty list" first of length n and then assign the values by index than it would to append each additional item.

  10. python - How can I automatically limit the length of a list as new ...

    But if you really want a custom list, having a cap on five elements, you can override the built-in list and it's methods, you would do something like this, for all it's methods.