About 360,000 results
Open links in new tab
  1. How do I declare an array in Python? - Stack Overflow

    Oct 3, 2009 · @AndersonGreen As I said there's no such thing as a variable declaration in Python. You would create a multidimensional list by taking an empty list and putting other lists …

  2. How to create an integer array in Python? - Stack Overflow

    Dec 7, 2009 · Use the array module. With it you can store collections of the same type efficiently. >>> import array >>> import itertools >>> a = array_of_signed_ints = array.array("i", …

  3. python - How to define a two-dimensional array? - Stack Overflow

    Jul 12, 2011 · I want to define a two-dimensional array without an initialized length like this: Matrix = [][] But this gives an error: IndexError: list index out of range

  4. Initialising an array of fixed size in Python - Stack Overflow

    One thing to note: all elements in the list will have initially the same id (or memory address). When you change any element later on in the code, this will impact only the specified value, - …

  5. Array of arrays (Python/NumPy) - Stack Overflow

    Aug 19, 2012 · I am using Python/NumPy, and I have two arrays like the following: array1 = [1 2 3] array2 = [4 5 6] And I ...

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

    Apr 4, 2015 · When I review python document and relearn python in detail now, I find range() built-in function it can directly make a list, but I look no one doing this. Depends, if you are …

  7. python - Convert a 1D array to a 2D array in numpy - Stack Overflow

    Sep 25, 2012 · I want to convert a 1-dimensional array into a 2-dimensional array by specifying the number of columns in the 2D array. Something that would work like this: > import numpy …

  8. How to declare and add items to an array in Python

    Python's array module. The standard library also has the array module, which is a wrapper over C arrays. Like C arrays, array.array objects hold only a single type (which has to be specified at …

  9. How to make lists contain only distinct element in Python?

    Dec 18, 2017 · The characteristics of sets in Python are that the data items in a set are unordered and duplicates are not allowed. If you try to add a data item to a set that already contains the …

  10. Create an Array of objects in Python - Stack Overflow

    Feb 1, 2015 · If you have an existing list of items from which you are creating this array of objects, the best thing you can do is use a list comprehension to build your new list. For instance, if you …

Refresh