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

    Aug 23, 2022 · There's no way to say in Python "this variable should never refer to anything other than a list", since Python is dynamically typed. * The default built-in Python type is called a list, …

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

    Oct 7, 2016 · Python doesn't have a built-in array data structure. The closest you get to that are lists.

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

    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 object creation time by …

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

    Jul 12, 2011 · 921 This question already has answers here: How to initialize a two-dimensional array (list of lists, if not using NumPy) in Python? (31 answers) List of lists changes reflected …

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

    I would like to know how i can initialize an array(or list), yet to be populated with values, to have a defined size. For example in C: int x[5]; /* declared without adding elements*/ How do I do ...

  6. How to declare an array in python - Stack Overflow

    Mar 20, 2016 · 4 This question already has answers here: How to declare array of zeros in python (or an array of a certain size) [duplicate] (10 answers)

  7. How to declare array of zeros in python (or an array of a certain size)

    Python's lists are lists, not arrays. And in Python you don't declare stuff like you do in C: you define functions and classes (via def and class statements), and assign to variables which, if …

  8. How to initialize a two-dimensional array (list of lists, if not using ...

    How to initialize a two-dimensional array (list of lists, if not using NumPy) in Python? Asked 15 years, 9 months ago Modified 1 year, 6 months ago Viewed 1.2m times

  9. python - How do I 'declare' an empty bytes variable? - Stack …

    Jan 21, 2022 · 47 How do I initialize ('declare') an empty bytes variable in Python 3? I am trying to receive chunks of bytes, and later change that to a utf-8 string. However, I'm not sure how to …

  10. python - Initialise numpy array of unknown length - Stack Overflow

    Apr 5, 2017 · 129 Build a Python list and convert that to a Numpy array. That takes amortized O (1) time per append + O (n) for the conversion to array, for a total of O (n).