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

    Apr 1, 2013 · A module is a file containing Python definitions and statements. The file name is the module name with the suffix .py. Create a file called hello.py with the following function as its content: def helloworld(): print "hello" Then you can. import hello hello.helloworld() To group many .py files, put them in a folder.

  2. Ideal Way to Create a Python "Library" - Stack Overflow

    Aug 12, 2012 · I want to create a "library" of Python modules which I will be able to access from several separate project folders. For example, I want the Python scripts in /proj1/ and /proj2/ to have access to /lib/.

  3. Create dynamic library (.so file) from Python code

    Apr 12, 2014 · Also you can do both ways i.e. extend python by writing library in C and call it from Python code OR code functions in C that could be called from Python. The standard term used (conceptually and help googling is "Python bindings" Official reference from python docs. General reference - Integrating python with other languages

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

    Aug 10, 2017 · 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 like regular Python packages such as pandas and numpy into my Jupyter notebook or into Pyzo.

  5. python - Automatically create file 'requirements.txt ... - Stack …

    Mar 19, 2019 · Firstly, your project file must be a py file which is direct python file. If your file is in ipynb format, you can convert it to py type by using the line of code below: jupyter nbconvert --to=python Then, you need to install pipreqs library from cmd (terminal for mac). pip install pipreqs Now we can create txt file by using the code below.

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

    May 6, 2016 · A. Create a folder which will contain all of your modules. As an example, lets use 'MyModules' B. Within the folder, save your classes in a py file. You can have more nesting than I'll demonstrate, but for simplicity we will not nest folders in this example. C. Create another python file in the same directory named __init__.py. Note there are 2 ...

  7. How to create PDF files in Python - Stack Overflow

    Python for PDF Generation The Portable Document Format (PDF) lets you create documents that look exactly the same on every platform. Sometimes a PDF document needs to be generated dynamically, however, and that can be quite a challenge. Fortunately, there are libraries that can help. This article examines one of those for Python.

  8. python - How to create new folder? - Stack Overflow

    Because os.path functions use the local rules of the python installation running the script for path strings. Using os.path.join in all cases assures that your paths will be formed correctly for the platform the script is being run on. –

  9. How to create a library in Python that available to be called in …

    Mar 23, 2022 · I need to create a simple library that will work in that way: I run python command prompt interpreter from Windows Start; Write import <a name of library> Then write m_relation(<arguments>) Interpreter shows a result of what I need; I already have written down the code I need.

  10. How to create a GUID/UUID in Python - Stack Overflow

    Aug 6, 2022 · If you're not going to bother using it in any UUID contexts, you may as well just use random.getrandbits(128).to_bytes(16, 'little') or (for crypto randomness) os.urandom(16) and get a full 128 bits of random (UUIDv4 uses 6-7 bits on version info).

Refresh