About 11,000,000 results
Open links in new tab
  1. How should I write a Windows path in a Python string literal?

    Apr 9, 2023 · However, the best practice is to use the os.path module functions that always joins with the correct path separator (os.path.sep) for your OS: os.path.join(mydir, myfile) From …

  2. How can I find where Python is installed on Windows?

    Mar 15, 2009 · Fortunately, typing path at the windows path let me find where I had installed it. The path was an option when I installed Python which I just forgot. If you didn't select setting …

  3. How to get an absolute file path in Python - Stack Overflow

    Sep 9, 2008 · I quote the Python 3 docs for abspath: "Return a normalized absolutized version of the pathname path." Not a"...version of the string path". A pathname, as defined by Posix, is …

  4. python - How do I get the full path of the current file's directory ...

    From that we can get the directory using either pathlib or the os.path module. Python 3. For the directory of the script being run: import pathlib pathlib.Path(__file__).parent.resolve() For the …

  5. python - Importing files from different folder - Stack Overflow

    By default, you can't. When importing a file, Python only searches the directory that the entry-point script is running from and sys.path which includes locations such as the package …

  6. How do I find out my PYTHONPATH using Python? - Stack Overflow

    Sep 28, 2009 · I find it easier to use the following, since it makes it clear if the empty string ('') is in the path: python -c "import sys, pprint; pprint.pprint(sys.path)" ( And I found this answer more …

  7. Relative paths in Python - Stack Overflow

    May 28, 2009 · Hi first of all you should understand functions os.path.abspath(path) and os.path.relpath(path) In short os.path.abspath(path) makes a relative path to absolute path. …

  8. python - What exactly should be set in PYTHONPATH ... - Stack …

    Here is what I learned: PYTHONPATH is a directory to add to the Python import search path "sys.path", which is made up of current dir. CWD, PYTHONPATH, standard and shared …

  9. Using Python, how can I access a shared folder on windows …

    Aug 24, 2011 · Running Python 3.6.5 on a Windows Machine, I used the format r"\\DriveName\then\file\path\txt.md" so the combination of double backslashes from reading …

  10. python - How to add to the PYTHONPATH in Windows, so it finds …

    Sep 13, 2010 · The question isn't about the PATH that DOS uses to find commands, but the Python path, i.e. sys.path in Python. In most operating systems, Python just uses the system …

Refresh