About 368,000 results
Open links in new tab
  1. python - How do I call a function from another .py file ... - Stack ...

    function(a, b) Note that file is one of Python's core modules, so I suggest you change the filename of file.py to something else. Note that if you're trying to import functions from a.py to a file …

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

    Jul 11, 2016 · In Python, the module is the natural place for global data: Each module has its own private symbol table, which is used as the global symbol table by all functions defined in the …

  3. In Python, when should I use a function instead of a method?

    The Zen of Python states that there should only be one way to do things- yet frequently I run into the problem of deciding when to use a function versus when to use a method. Let's take a …

  4. python - Why do some functions have underscores - Stack Overflow

    May 24, 2024 · In Python, the use of an underscore in a function name indicates that the function is intended for internal use and should not be called directly by users. It is a convention used …

  5. How can I use a DLL file from Python? - Stack Overflow

    Oct 31, 2008 · 237 What is the easiest way to use a DLL file from within Python? Specifically, how can this be done without writing any additional wrapper C++ code to expose the functionality to …

  6. python - How do I get ("return") a result (output) from a function?

    We can make a tuple right on the return line; or we can use a dictionary, a namedtuple (Python 2.6+), a types.simpleNamespace (Python 3.3+), a dataclass (Python 3.7+), or some other …

  7. How do I call a parent class's method from a child class in Python?

    When creating a simple object hierarchy in Python, I'd like to be able to invoke methods of the parent class from a derived class. In Perl and Java, there is a keyword for this (super). In Perl, I

  8. python - How to use a variable defined inside one function from …

    The simplest option is to use a global variable. Then create a function that gets the current word. Notice that to global variables inside a function, you do need to use the global keyword. …

  9. How to import functions from other projects in Python?

    Ideally both projects will be an installable python package, replete with __init__.py and setup.py. They could then be installed with python setup.py install or similar. If that is not possible, don't …

  10. python - How do I pass variables across functions? - Stack Overflow

    I want to pass values (as variables) between different functions. For example, I assign values to a list in one function, then I want to use that list in another function: list = [] def defineALis...