[Python-ideas] os.path.join

Ben Finney ben+python at benfinney.id.au
Mon Nov 4 22:22:35 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're not using the right tool: ‘os.path’ is specifically about
filesystem paths. URLs follow different rules, as you say; you should be
using ‘urllib.parse’ <URL:http://docs.python.org/3/library/urllib.parse.html>.

-- 
 \     “Our task must be to free ourselves from our prison by widening |
  `\    our circle of compassion to embrace all humanity and the whole |
_o__)                       of nature in its beauty.” —Albert Einstein |
Ben Finney



More information about the Python-ideas mailing list