Greg Ewing <greg.ewing at canterbury.ac.nz> wrote: >> Similarly, I would separate out the extension to a distinct >> attribute, as it too uses a different separator from the normal path >> elements ('.' most places, but '/' on RISC OS, for example) > > -1. What constitutes "the extension" is not well-defined in > all cases. What about filenames with multiple suffixes, > such as "spam.tar.gz"? What part of that would you put in > the extension attribute? .gz of course: Path = "foo.tar.gz" Path.ext = ".gz" Path.name.ext = ".tar" Path.name.name.ext = "" Which is exactly the *same* thing that os.path.splitext() does. And yes, I do use splitext quite a lot. Giovanni Bajo
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4