The top search engine result for “pathlib absolute” is this StackOverflow question. The top answers given are:
resolve(), do not use
Trying both (in
C:\example\) I get:
>>> from pathlib import Path >>> print(Path('file.txt').absolute()) C:\example\file.txt >>> print(Path('file.txt').resolve()) file.txt
absolute() works as expected,
resolve() does not work.
absolute() is undocumented and https://bugs.python.org/issue29688 seems stuck, and very negative to
absolute(). This is very confusing.
resolve() supposed to work?
I want to write a simple command line tool that works for both
tool.py file.txt and
tool.py C:\example\file.txt. How can
resolve() turn both into
absolute() does? Or is it fine to use