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

    Apr 9, 2023 · Path takes a path-like string and adjusts everything for the current OS, either Windows or Linux. For example, on Linux it would convert all backslashes to forward slashes, and on Windows it …

  2. Python path as a string - Stack Overflow

    Feb 3, 2014 · 37 I am specifying a relative file path using jacaro's path module. How can I get the absolute path from this variable as a string?

  3. Extract file name from path, no matter what the os/path format

    Dec 5, 2011 · Which Python library can I use to extract filenames from paths, no matter what the operating system or path format could be? For example, I'd like all of these paths to return me c: …

  4. File paths in Python in the form of string throw errors

    Dec 19, 2012 · I need to put a lot of filepaths in the form of strings in Python as part of my program. For example one of my directories is D:\\ful_automate\\dl. But Python recognizes some of the characters …

  5. string - How do I get the filename without the extension from a path in ...

    Why do you resolve() the path? Is it really possible to get a path to a file and not have the filename be a part of the path without that? This means that if you're give a path to symlink, you'll return the …

  6. python - How can I create a full path to a file from parts (e.g. path ...

    I need to pass a file path name to a module. How do I build the file path from a directory name, base filename, and a file format string? The directory may or may not exist at the time of call. ...

  7. python - Convert WindowsPath to String - Stack Overflow

    As most other Python classes do, the WindowsPath class, from pathlib, implements a non-defaulted " dunder string " method (__str__). It turns out that the string representation returned by that method …

  8. python - Convert a str to path type? - Stack Overflow

    Jul 22, 2021 · What is path.path? Sounds like a class that is defined by the code you are using; it's not a standard type or class. Prior to Python 3.4, there was no standard for paths; functions operating on …

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

    Sep 9, 2008 · You could give any pathname- non-existent files and directory heirarchies are fine- and abspath will simply resolve the bits of the path (including the parent directory ".. " element) and return …

  10. How can I extract the folder path from file path in Python?

    Although, I would recommend using the os.path.dirname function to do this, you just need to pass the string, and it'll do the work for you. Since, you seem to be on windows, consider using the abspath …