How to get absolute path of a pathlib.Path object?

后端 未结 4 1223
暗喜
暗喜 2021-02-03 16:56

Making a path object with pathlib module like:

p = pathlib.Path(\'file.txt\')

The p object will point to some file in

4条回答
  •  生来不讨喜
    2021-02-03 17:35

    If you simply want the path and do not want to check if the file exists, you can do

    str(p)
    

    as document in the Operations section.

提交回复
热议问题