conversion between (OS native) paths and urls

Peter Otten __peter__ at web.de
Mon Jul 5 14:40:34 EDT 2004


Stefan Seefeld wrote:

> What is the suggested way to generate an url from a path,
> dealing with issues such as backslash-to-slash conversion on windows ?

>>> urllib.pathname2url("space jam/index.html")
'space%20jam/index.html'
>>>

I'm confident that it will do the right thing on windows, too.

Peter




More information about the Python-list mailing list