About 19,600,000 results
Open links in new tab
  1. Python: list of lists - Stack Overflow

    The first, [:], is creating a slice (normally often used for getting just part of a list), which happens to contain the entire list, and thus is effectively a copy of the list. The second, list(), is using the actual …

  2. slice - How slicing in Python works - Stack Overflow

    The first way works for a list or a string; the second way only works for a list, because slice assignment isn't allowed for strings. Other than that I think the only difference is speed: it looks like it's a little …

  3. How can I pass a list as a command-line argument with argparse?

    Don't use quotes on the command line 1 Don't use type=list, as it will return a list of lists This happens because under the hood argparse uses the value of type to coerce each individual given argument …

  4. python - Access item in a list of lists - Stack Overflow

    Jul 19, 2014 · 67 If I have a list of lists and just want to manipulate an individual item in that list, how would I go about doing that? For example: List1 = [[10,13,17],[3,5,1],[13,11,12]] What if I want to take …

  5. How to group dataframe rows into list in pandas groupby

    Given a dataframe, I want to groupby the first column and get second column as lists in rows, so that a dataframe like: a b A 1 A 2 B 5 B 5 B 4 C 6 becomes A [1,2] B [5,5,4] C [6] How do I do this?

  6. Array versus List<T>: When to use which? - Stack Overflow

    Jan 12, 2009 · A List uses an internal array to handle its data, and automatically resizes the array when adding more elements to the List than its current capacity, which makes it more easy to use than an …

  7. Python list vs. array – when to use? - Stack Overflow

    Aug 17, 2022 · The list is the part of python's syntax so it doesn't need to be declared whereas you have to declare the array before using it. You can store values of different data-types in a list …

  8. c# - How to initialize a list of strings (List<string>) with many ...

    How is it possible to initialize (with a C# initializer) a list of strings? I have tried with the example below but it's not working. List<string> optionList = new List<string> { "

  9. Find an item in a list by LINQ - Stack Overflow

    If we need to find an element from the list, then we can use the Find and FindAll extensions method, but there is a slight difference between them. Here is an example.

  10. Checking if any elements in one list are in another [duplicate]

    Apr 22, 2013 · The second action taken was to revert the accepted answer to its state before it was partway modified to address "determine if all elements in one list are in a second list".