About 50 results
Open links in new tab
  1. Best and/or fastest way to create lists in python

    In python, as far as I know, there are at least 3 to 4 ways to create and initialize lists of a given size: Simple loop with append: my_list = [] for i in range(50): my_list.append(0) Simple ...

  2. Creating a list of integers in Python - Stack Overflow

    Aug 19, 2021 · How about just [1,2,3,4]? (If you are at this level of understanding, it would be better if you just follow a tutorial and make sure you understand the fundamentals of Python.)

  3. python - How do I create a list with numbers between two values ...

    How do I create a list of numbers between two values? For example, a list between 11 and 16: [11, 12, 13, 14, 15, 16]

  4. python - how to create a list of lists - Stack Overflow

    Sep 6, 2012 · In order to create a list of lists you will have firstly to store your data, array, or other type of variable into a list. Then, create a new empty list and append to it the lists that you just created.

  5. python - How would you make a comma-separated string from a list of ...

    What would be your preferred way to concatenate strings from a sequence such that between every two consecutive pairs a comma is added. That is, how do you map, for instance, ['a', 'b', 'c'] to 'a,...

  6. How to convert comma-delimited string to list in Python?

    Oct 21, 2011 · How to convert comma-delimited string to list in Python? Asked 14 years, 2 months ago Modified 5 years, 8 months ago Viewed 533k times

  7. How do I return dictionary keys as a list in Python?

    With Python 2.7, I can get dictionary keys, values, or items as a list:

  8. Get unique values from a list in python - Stack Overflow

    Oct 15, 2012 · 1539 First declare your list properly, separated by commas. You can get the unique values by converting the list to a set.

  9. python - How do I fast make a list of 1~100? - Stack Overflow

    Apr 4, 2015 · 6 In Python 2.x If you want to create a list of numbers from 1 to 100, you simply do:

  10. python - How can I get list of values from dict? - Stack Overflow

    Mar 30, 2018 · 695 How can I get a list of the values in a dict in Python? In Java, getting the values of a Map as a List is as easy as doing list = map.values();. I'm wondering if there is a similarly simple way …