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 76f587b commit 73e122fCopy full SHA for 73e122f
1 file changed
Lib/ntpath.py
@@ -83,16 +83,21 @@ def split(p):
83
84
85
# Split a path in root and extension.
86
-# The extension is everything starting at the first dot in the last
+# The extension is everything starting at the last dot in the last
87
# pathname component; the root is everything before that.
88
# It is always true that root + ext == p.
89
90
def splitext(p):
91
root, ext = '', ''
92
for c in p:
93
- if c in '/\\':
+ if c in ['/','\\']:
94
root, ext = root + ext + c, ''
95
- elif c == '.' or ext:
+ elif c == '.':
96
+ if ext:
97
+ root, ext = root + ext, c
98
+ else:
99
+ ext = c
100
+ elif ext:
101
ext = ext + c
102
else:
103
root = root + c
0 commit comments