Python Forum
getting a full path string from a pathlib.PurePath object
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
getting a full path string from a pathlib.PurePath object
#1
is the proper way to get the plain string path of a pathlib.PurePath object or pathlib.Path object to pass it to str() and use what that returns? that is all i can find. the documentation (i have the 3.5.2 PDF) only describes the .name attribute for part of the path. i suppose i could join the .parts value in some way.

    import pathlib
    ...
    fp = pathlib.Path('foo/bar')
    ...
    fn = str(fp)
this is only the 2nd time using this module and the 1st time didn't need this.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Messages In This Thread
getting a full path string from a pathlib.PurePath object - by Skaperen - Mar-20-2018, 05:15 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  -i option changes sys.path (removes leading empty string '') markanth 6 2,107 Aug-26-2022, 09:27 PM
Last Post: markanth
  Pathlib import not working chriswrcg 9 3,984 May-29-2022, 07:37 PM
Last Post: snippsat
  Convert string to path using Python 2.7 tester_V 10 6,667 Nov-20-2021, 02:20 PM
Last Post: snippsat
  WebDriverException: Message: 'PATH TO CHROME DRIVER' executable needs to be in PATH Led_Zeppelin 1 2,280 Sep-09-2021, 01:25 PM
Last Post: Yoriz
  deleting an empty Dir, using pathlib.Path tester_V 9 6,060 Jul-01-2021, 01:53 PM
Last Post: Gribouillis
  Trying to pathlib instead of os.path tester_V 4 2,595 Jun-22-2021, 04:15 AM
Last Post: tester_V
  TypeError: int() argument must be a string, a bytes-like object or a number, not 'Non Anldra12 2 5,346 May-02-2021, 03:45 PM
Last Post: Anldra12
  pathlib destpath.exists() true even file does not exist NaN 9 4,791 Dec-01-2020, 12:43 PM
Last Post: NaN
  How to convert a string "<... object at POINTER>" to an object? mandaxyz 5 3,800 Aug-08-2020, 10:44 PM
Last Post: mandaxyz
  C-API for Python 3 - Get String from Object mga010 2 3,708 Jun-23-2020, 04:32 PM
Last Post: mga010

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020