tagged [list]

Python list slice syntax used for no obvious reason

Python list slice syntax used for no obvious reason I occasionally see the list slice syntax used in Python code like this: Surely this is just the same as: Or am I missing something?

20 May at 08:40

Most concise way to convert a Set<T> to a List<T>

Most concise way to convert a Set to a List For example, I am currently doing this: Can you beat this ?

13 Jan at 11:7

what is the property for the size of a List in C#?

what is the property for the size of a List in C#? How do you access the size of a List in c#? In an array it's array.length, but what is the property for a List?

22 Aug at 18:52

Python - use list as function parameters

Python - use list as function parameters How can I use a Python list (e.g. `params = ['a',3.4,None]`) as parameters to a function, e.g.:

12 Feb at 17:43

Generator expressions vs. list comprehensions

Generator expressions vs. list comprehensions When should you use generator expressions and when should you use list comprehensions in Python?

Why is it string.join(list) instead of list.join(string)?

Why is it string.join(list) instead of list.join(string)? This has always confused me. It seems like this would be nicer: Than this: Is there a specific reason it is like this?

1 Apr at 02:51

Copying a portion of a list to a new list

Copying a portion of a list to a new list Hey all. Is there a way to copy only a portion of a single (or better yet, a two) dimensional list of strings into a new temporary list of strings?

29 May at 15:59

Shuffling a list of objects

Shuffling a list of objects How do I shuffle a list of objects? I tried [random.shuffle](https://docs.python.org/library/random.html#random.shuffle): But it outputs:

29 Jul at 04:45

How to Get a Sublist in C#

How to Get a Sublist in C# I have a `List` and i need to take a sublist out of this list. Is there any methods of List available for this in .NET 3.5?

2 Feb at 02:53

How can I convert List<byte> to byte[] in C#?

How can I convert List to byte[] in C#? Can I convert via a `for` loop? Is there any better method to do it? ``` for (int i = 0; i

18 Apr at 16:57

Dump a list in a pickle file and retrieve it back later

Dump a list in a pickle file and retrieve it back later I'm trying to save a list of strings, so that it can be accessed later. How can it be achieved using pickle? An illustrative example could help.

14 Oct at 18:34

C#: How to add subitems in ListView

C#: How to add subitems in ListView Creating an item(Under the key) is easy,but how to add subitems(Value)?

28 Aug at 22:4

Filtering a list of strings based on contents

Filtering a list of strings based on contents Given the list `['a','ab','abc','bac']`, I want to compute a list with strings that have `'ab'` in them. I.e. the result is `['ab','abc']`. How can this b...

30 Mar at 10:23

Python Sets vs Lists

Python Sets vs Lists In Python, which data structure is more efficient/speedy? Assuming that order is not important to me and I would be checking for duplicates anyway, is a Python set slower than a P...

How to remove duplicates from a list?

How to remove duplicates from a list? I want to remove duplicates from a list but what I am doing is not working:

6 Jan at 09:43

How to get All Dates in a given month in C#

How to get All Dates in a given month in C# I want to make a function that take month and year and return `List` filled with all dates in this month. any help will be appreciated Thanks in Advance

3 Oct at 14:19

find index of an int in a list

find index of an int in a list Is there a way to get the index of an int from a list? Looking for something like `list1.FindIndex(5)` where I want to find the position of 5 in the list.

26 Jun at 02:42

Convert List<int> to string of comma separated values

Convert List to string of comma separated values having a `List` of integers (for example: `1 - 3 - 4`) how can I convert it in a string of this type? For example, the output should be:

9 Jan at 10:42

How to add a range of items to an IList?

How to add a range of items to an IList? There is no `AddRange()` method for `IList`. How can I add a list of items to an `IList` without iterating through the items and using the `Add()` method?

30 Jan at 02:19

Remove all but the first item in a list

Remove all but the first item in a list let us consider a list as below list contains values as `a,b,c,d`.... i need a query to just remove all the values in the list other than that "a".

7 Feb at 08:43

Selecting unique elements from a List in C#

Selecting unique elements from a List in C# How do I select the unique elements from the list `{0, 1, 2, 2, 2, 3, 4, 4, 5}` so that I get `{0, 1, 3, 5}`, effectively removing the repeated elements `{2...

18 Jan at 08:15

How can I sort List<T> based on properties of T?

How can I sort List based on properties of T? My Code looks like this : I tried optionInfoList.Sort() but it is not working.

3 Mar at 05:33

List with timeout/expire ability

List with timeout/expire ability I need a function like this: It looks like self-descriptive, the item will automatically expire and removed from the list. I couldn't imagine how to do that. Can anyon...

14 Feb at 09:32

Getting a list of values from a list of dicts

Getting a list of values from a list of dicts I have a list of dicts like this: I want `['apple', 'banana', 'cars']` Whats the best way to do this?

5 Apr at 08:4

How to get the list of all installed color schemes in Vim?

How to get the list of all installed color schemes in Vim? Is there a way to get a list of all installed color schemes in Vim? That would make very easy to select one without looking at the `.vim` dir...

5 Oct at 00:44