About 3,970,000 results
Open links in new tab
  1. Python Variable Declaration - Stack Overflow

    Jun 13, 2012 · As of Python 3, you can explicitly declare variables by type. For instance, to declare an integer one can do it as follows: x: int = 3 or: def f(x: int): return x see this question …

  2. How do I declare an array in Python? - Stack Overflow

    Oct 3, 2009 · A couple of contributions suggested that arrays in python are represented by lists. This is incorrect. Python has an independent implementation of array() in the standard library …

  3. Is it possible only to declare a variable without assigning any value ...

    Mar 20, 2009 · Python is dynamic, so you don't need to declare things; they exist automatically in the first scope where they're assigned. So, all you need is a regular old assignment statement …

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

    Jul 12, 2011 · In Python you will be creating a list of lists. You do not have to declare the dimensions ahead of time, but you can. For example: matrix = [] matrix.append([]) …

  5. How do I create a constant in Python? - Stack Overflow

    Apr 21, 2010 · Note that back in 2010, this answer made sense, but ever since Python 3.4's release in 2014, the answer is "you want to use enum for this", which lets you set an …

  6. Creating a new dictionary in Python - Stack Overflow

    For anyone reading this: the last "solution" is a bit of a joke - you can use it (in python 2.x at least - won't work in py3k), but no one in it's own mind would ever want to do so ;-) – bruno desthuilliers

  7. struct - C-like structures in Python - Stack Overflow

    Aug 30, 2008 · There is a python package exactly for this purpose. see cstruct2py. cstruct2py is a pure python library for generate python classes from C code and use them to pack and unpack …

  8. How to declare variable type, C style in Python - Stack Overflow

    Oct 14, 2010 · Edit: Python 3.5 introduced type hints which introduced a way to specify the type of a variable. This answer was written before this feature became available. There is no way to …

  9. python - How can I use a global variable in a function? - Stack …

    Jul 11, 2016 · If you declare a variable outside the brackets, it become global (accessible to all functions and other brackets). If you declare a variable inside the brackets, it become local …

  10. Explicitly declaring a variable type in Python - Stack Overflow

    Python has no type declarations. Python 3 introduces something called function annotations , which Guido sometimes refers to as "the thing that isn't type declarations," because the most …

Refresh