About 483,000 results
Open links in new tab
  1. How to write a Python module/package? - Stack Overflow

    481 A module is a file containing Python definitions and statements. The file name is the module name with the suffix .py create hello.py then write the following function as its content:

  2. How to Create and Import a Custom Module in Python

    C. Create another python file in the same directory named __init__.py. Note there are 2 underscores before and after 'init'. Within that file, import the file you need. The syntax should …

  3. python - How to create a log file every day using logging module ...

    42 I'm new to logging module of Python. I want to create a new log file every day while my application is in running condition.

  4. python - Using logging in multiple modules - Stack Overflow

    main() See here for logging from multiple modules, and here for logging configuration for code which will be used as a library module by other code. Update: When calling fileConfig(), you …

  5. python - What is __main__.py? - Stack Overflow

    Oct 28, 2010 · $ python my_program_dir $ python my_program.zip # Or, if the program is accessible as a module $ python -m my_program You'll have to decide for yourself whether …

  6. How to create module-wide variables in Python? [duplicate]

    Dec 30, 2009 · Here is what is going on. First, the only global variables Python really has are module-scoped variables. You cannot make a variable that is truly global; all you can do is …

  7. Create empty file using python - Stack Overflow

    Closed 10 years ago. I'd like to create a file with path x using python. I've been using os.system(y) where y = 'touch %s' % (x). I've looked for a non-directory version of os.mkdir, but I haven't …

  8. How to create python C++ extension with submodule that can be …

    May 10, 2023 · I'm creating a C++ extension for python. It creates a module parent that contains a sub-module child. The child has one method hello(). It works fine if I call it as import parent …

  9. Defining private module functions in python - Stack Overflow

    41 Python allows for private class members with the double underscore prefix. This technique doesn't work at a module level so I am thinking this is a mistake in Dive Into Python. Here is …

  10. How to create modules in Jupyter notebook and import them?

    Aug 10, 2017 · 16 I've created multiple python modules as .py files in a Python IDE called Pyzo in the following path: 'C:\Users\Michael\Anaconda3\Lib\site-packages' which I can then import …