About 7,000,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. python - What does [:] mean? - Stack Overflow

    Jul 16, 2019 · used for limiter or slicing in array , hash eg: [1:5] for displaying values between 1 inclusive and 5 exclusive i.e 1-4 [start:end] basically used in array for slicing , understand …

  3. python - What does [:, :] mean on NumPy arrays - Stack Overflow

    numpy uses tuples as indexes. In this case, this is a detailed slice assignment. [0] #means line 0 of your matrix [(0,0)] #means cell at 0,0 of your matrix [0:1] #means lines 0 to 1 excluded of …

  4. python - array.array versus numpy.array - Stack Overflow

    Jun 21, 2022 · In defense of array.array, I think its important to note that it is also a lot more lightweight than numpy.array, and that saying 'will do just fine' for a 1D array should really be …

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

    Aug 17, 2022 · array.array is also a reasonable way to represent a mutable string in Python 2.x (array('B', bytes)). However, Python 2.6+ and 3.x offer a mutable byte string as bytearray . …

  6. python - Check if item is in an array / list - Stack Overflow

    I'm also going to assume that you mean "list" when you say "array." Sven Marnach's solution is good. If you are going to be doing repeated checks on the list, then it might be worth …

  7. What is :: (double colon) in Python when subscripting sequences?

    (Caution: this is a NumPy array specific example with the aim of illustrating the a use case of "double colons" :: for jumping of elements in multiple axes. This example does not cover native …

  8. python - Difference between array[i][:] and array[i ... - Stack Overflow

    May 17, 2017 · x[:] makes a shallow copy of a list, but is virtually useless when x is an array. It makes a new view - same data and shape, but different array object.

  9. 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 …

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

    Oct 7, 2016 · 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", …