About 247,000 results
Open links in new tab
  1. python - How do I remove/delete/replace a folder that is not empty ...

    Also note that even if the directory was empty, os.remove would fail again, because the correct function is os.rmdir .

  2. pathlib.Path vs. os.path.join in Python - Stack Overflow

    Apr 15, 2021 · When I need to define a file system path in my script, I use os.path.join to guarantee that the path will be consistent on different file systems: from os import path path_1 = …

  3. python - How to install the os module? - Stack Overflow

    os is a standard Python module, there's no need install it. So import os should always work inside Python, and if it doesn't, the cause is your PYTHONPATH or IDE settings, look at them; don't start …

  4. How can I delete a file or folder in Python? - Stack Overflow

    On Python 3.3 and below, you can use these methods instead of the pathlib ones: os.remove() removes a file. os.unlink() removes a symbolic link. os.rmdir() removes an empty directory.

  5. linux - Why use Python's os module methods instead of executing shell ...

    Feb 18, 2015 · I am trying to understand what is the motivation behind using Python's library functions for executing OS-specific tasks such as creating files/directories, changing file attributes, etc. instead …

  6. How do I move a file in Python? - Stack Overflow

    Jan 13, 2012 · for those of you familiar with gnu-coreutils' mv command, python's shutil.move has one edge case where shutil.move function differs. Go here for full write up. In a nutshell, Python's …

  7. python - Using the OS library for volumes and external locations (abfss ...

    Sep 29, 2023 · 1 I have several processes in Databricks using the OS library, for creating txt files, checking directories, etc. With the arrival of Volumes and the use of external locations "abfss", mount …

  8. How to set environment variables in Python? - Stack Overflow

    I need to set some environment variables in the Python script and I want all the other scripts that are called from Python to see the environment variables' set. If I do, os.environ["DEBUSSY&q...

  9. Set LD_LIBRARY_PATH before importing in python - Stack Overflow

    Apr 23, 2014 · Python, when gets the values of environment variables as in os.environ['LD_LIBRARY_PATH'] or os.environ['PATH'], it copies the values, into a dictionary, from …

  10. How to identify which OS Python is running on - Stack Overflow

    The above Python program will show you the output of the most commonly used built-in functions, already provided by os, sys, platform, site. So the best way to get only the essential code is looking …