[New-bugs-announce] [issue34931] os.path.splitext with more dots

Jan Novak report at bugs.python.org
Mon Oct 8 08:06:01 EDT 2018


New submission from Jan Novak <xnovakj at users.sourceforge.net>:

There are some old tickets about changing splitext() in 2007:
https://bugs.python.org/issue1115886
https://bugs.python.org/issue1681842

Present python documentation:
Leading periods on the basename are ignored; splitext('.cshrc') returns ('.cshrc', '').
Changed in version 2.6: Earlier versions could produce an empty root when the only period was the first character.

But nobody take care about more than one dots:
For example this possible corect filenames:

>>> os.path.splitext('....jpg')
('....jpg', '')

So present function is insuficient (buggy) to use to detect right extension.
Maybe new parameter would be helpfull for that?
Like parameter "preserve_dotfiles" discussed in 2007.

And what to do with the wrong '.', '..', '...', ... filenames?

----------
messages: 327346
nosy: xnovakj
priority: normal
severity: normal
status: open
title: os.path.splitext with more dots
type: behavior

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34931>
_______________________________________


More information about the New-bugs-announce mailing list