mirror of
https://github.com/python/cpython.git
synced 2025-07-28 13:44:43 +00:00
Bug #1115886: os.path.splitext('.cshrc') gives now ('.cshrc', '').
This commit is contained in:
parent
f08c073ded
commit
05c075d629
9 changed files with 69 additions and 40 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
import os
|
||||
from stat import *
|
||||
import genericpath
|
||||
from genericpath import *
|
||||
|
||||
__all__ = ["normcase","isabs","join","splitdrive","split","splitext",
|
||||
|
@ -69,17 +70,8 @@ def split(s):
|
|||
|
||||
|
||||
def splitext(p):
|
||||
"""Split a path into root and extension.
|
||||
The extension is everything starting at the last dot in the last
|
||||
pathname component; the root is everything before that.
|
||||
It is always true that root + ext == p."""
|
||||
|
||||
i = p.rfind('.')
|
||||
if i<=p.rfind(':'):
|
||||
return p, ''
|
||||
else:
|
||||
return p[:i], p[i:]
|
||||
|
||||
return genericpath._splitext(p, sep, altsep, extsep)
|
||||
splitext.__doc__ = genericpath._splitext.__doc__
|
||||
|
||||
def splitdrive(p):
|
||||
"""Split a pathname into a drive specification and the rest of the
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue