About 329,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. slice - How slicing in Python works - Stack Overflow

    How Python Figures Out Missing Parameters: When slicing, if you leave out any parameter, Python tries to figure it out automatically. If you check the source code of CPython, you will …

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

    Aug 17, 2022 · Mostly, you should use it when you need to expose a C array to an extension or a system call (for example, ioctl or fctnl). array.array is also a reasonable way to represent a …

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

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

    Jul 12, 2011 · Matrix operations in numpy most often use an array type with two dimensions. There are many ways to create a new array; one of the most useful is the zeros function, …

  7. Byte Array in Python - Stack Overflow

    May 28, 2013 · How can I represent a byte array (like in Java with byte[]) in Python? I'll need to send it over the wire with gevent. byte key[] = {0x13, 0x00, 0x00, 0x00, 0x08, 0x00};

  8. python - Explain this 4D numpy array indexing intuitively - Stack …

    2 Dimensional array is an array of 1D array. The index used can be thought as the number of 1D array, for example, TwoD[1,2] refers to the 2nd 1D array, and the 3rd in the 1D. 3 Dimensional …

  9. How can I create an array/list of dictionaries in python?

    @devon: No, they aren't. Note, for example, that if you run weightMatrix[0]['A'] += 1, then weightMatrix[1] still has all 0's in its dictionary values. The list comprehension works differently …

  10. What is the best way to create a string array in python?

    The best and most convenient method for creating a string array in python is with the help of NumPy library. Example: import numpy as np arr = np.chararray((rows, columns)) This will …

Refresh