Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
os.path.join
#3
(Nov-07-2020, 06:14 PM)bowlofred Wrote:
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'

Thank you
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 - errors out tester_V 4 576 Nov-29-2020, 08:57 AM
Last Post: DeaD_EyE
  The difference between os.path.join( and os.sep.join( Pedroski55 2 1,052 Nov-17-2020, 08:38 AM
Last Post: Pedroski55
  SQL select join operation in python(Select.. join) pradeepkumarbe 1 971 Feb-14-2019, 08:34 PM
Last Post: woooee
  .pth file does not show up in sys.path when configuring path. arjunsingh2908 2 2,849 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