Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
os.path.join
#2
Quote:Help on function join in module posixpath:

join(a, *p)
Join two or more pathname components, inserting '/' as needed.
If any component is an absolute path, all previous path components
will be discarded.
An empty last part will result in a path that
ends with a separator.

Your second path starts with a separator, so it is considered an absolute path. Therefore the first path is discarded.

>>> os.path.join('/Volumes/Sidekick/SEER/Trip', '/data/source')
'/data/source'
>>> os.path.join('/Volumes/Sidekick/SEER/Trip', 'data/source')
'/Volumes/Sidekick/SEER/Trip/data/source'
Reply


Messages In This Thread
os.path.join - by qmfoam - Nov-07-2020, 06:06 PM
RE: os.path.join - by bowlofred - Nov-07-2020, 06:14 PM
RE: os.path.join - by qmfoam - Nov-08-2020, 04:03 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  os.path.join() 'NoneType' confusion gowb0w 11 1,539 Sep-22-2023, 11:13 PM
Last Post: deanhystad
  WebDriverException: Message: 'PATH TO CHROME DRIVER' executable needs to be in PATH Led_Zeppelin 1 2,203 Sep-09-2021, 01:25 PM
Last Post: Yoriz
  os.path.join - errors out tester_V 4 2,693 Nov-29-2020, 08:57 AM
Last Post: DeaD_EyE
  The difference between os.path.join( and os.sep.join( Pedroski55 2 9,436 Nov-17-2020, 08:38 AM
Last Post: Pedroski55
  SQL select join operation in python(Select.. join) pradeepkumarbe 1 2,232 Feb-14-2019, 08:34 PM
Last Post: woooee
  .pth file does not show up in sys.path when configuring path. arjunsingh2908 2 5,740 Jul-03-2018, 11:16 AM
Last Post: arjunsingh2908

Forum Jump:

User Panel Messages

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