[Python-ideas] os.path.join

Ben Finney ben+python at benfinney.id.au
Mon Nov 4 22:25:27 CET 2013


anatoly techtonik <techtonik at gmail.com>
writes:

> Right. But I am working more with URL paths nowadays. In there if I
> want to join two paths, no matter if 2nd starts with slash or not, I
> don't really expect the 2nd to rewrite the first.

Then you are using the wrong tool for the job: ‘os.path’ is specifically
for manipulating OS filesystem paths.

URLs follow different rules, as you say. For those, use the standard
library <URL:http://docs.python.org/3/library/urllib.parse.html>
‘urllib.parse’ module.

-- 
 \      “When I was born I was so surprised I couldn't talk for a year |
  `\                                        and a half.” —Gracie Allen |
_o__)                                                                  |
Ben Finney



More information about the Python-ideas mailing list