About 285,000 results
Open links in new tab
  1. python - Define a list with type - Stack Overflow

    Jan 14, 2015 · Define a list with type Asked 15 years, 11 months ago Modified 1 year, 4 months ago Viewed 151k times

  2. 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

  3. Create an empty list with certain size in Python - Stack Overflow

    How do I create an empty list that can hold 10 elements? After that, I want to assign values in that list. For example: xs = list() for i in range(0, 9): xs[i] = i However, that gives IndexError:

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

    I'm beginning python and I'm trying to use a two-dimensional list, that I initially fill up with the same variable in every place. I came up with this: def initialize_twodlist(foo): twod_list ...

  5. How to specify method return type list of (what) in Python?

    Oct 3, 2018 · Edit: With the new 3.9 version of Python, you can annotate types without importing from the typing module. The only difference is that you use real type names instead of defined types in the …

  6. Python - use list as function parameters - Stack Overflow

    Python - use list as function parameters [duplicate] Asked 14 years, 9 months ago Modified 6 years, 2 months ago Viewed 221k times

  7. python - How to create a list of objects? - Stack Overflow

    Aug 15, 2020 · 5 The Python Tutorial discusses how to use lists. Storing a list of classes is no different than storing any other objects.

  8. How to specify that a parameter is a list of specific objects in Python ...

    I really like using docstrings in Python to specify type parameters when projects get beyond a certain size. I'm having trouble finding a standard to use to specify that a parameter is a list of specific …

  9. Initialise a list to a specific length in Python - Stack Overflow

    Closed 9 years ago. How do I initialise a list with 10 times a default value in Python? I'm searching for a good-looking way to initialize a empty list with a specific range. So make a list that contains 10 zeros …

  10. python - Specify a list of strings as a function param types - Stack ...

    Apr 1, 2020 · I'm trying to define a list of str as a type for a function param but I don't know how to do this I know that python allows you to define functions specifying the type of value expected by the …