Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent abfdd70 commit ae590dbCopy full SHA for ae590db
1 file changed
Lib/dospath.py
@@ -35,15 +35,18 @@ def isabs(s):
35
return s != '' and s[:1] in '/\\'
36
37
38
-# Join two pathnames.
39
-# Ignore the first part if the second part is absolute.
40
-# Insert a '/' unless the first part is empty or already ends in '/'.
41
-
42
-def join(a, b):
43
- if isabs(b): return b
44
- if a == '' or a[-1:] in '/\\': return a + b
45
- # Note: join('x', '') returns 'x/'; is this what we want?
46
- return a + os.sep + b
+# Join two (or more) paths.
+
+def join(a, *p):
+ path = a
+ for b in p:
+ if isabs(b):
+ path = b
+ elif path == '' or path[-1:] in '/\\':
+ path = path + b
47
+ else:
48
+ path = path + os.sep + b
49
+ return path
50
51
52
# Split a path in a drive specification (a drive letter followed by a
0 commit comments