conversion between (OS native) paths and urls

Discussion in 'Python' started by Stefan Seefeld, Jul 5, 2004.

  1. hi there,

    I'm generating a set of html pages that refer to each other
    via relative URLs. However, during the generation of these
    files I only deal with paths (as generated by the os.path module).
    What is the suggested way to generate an url from a path,
    dealing with issues such as backslash-to-slash conversion on windows ?

    Thanks,
    Stefan
     
    Stefan Seefeld, Jul 5, 2004
    #1
    1. Advertisements

  2. Stefan Seefeld

    Peter Otten Guest

    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
     
    Peter Otten, Jul 5, 2004
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Gopal
    Replies:
    4
    Views:
    480
    Dario
    Oct 30, 2003
  2. Kaidi
    Replies:
    5
    Views:
    804
    Andrew Thompson
    Jan 4, 2004
  3. Noah
    Replies:
    5
    Views:
    1,113
  4. David

    URLs and Paths and stuff

    David, Feb 11, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    945
    David
    Feb 12, 2007
  5. Nathan Sokalski

    Converting Relative URLs into Absolute URLs

    Nathan Sokalski, Aug 11, 2008, in forum: ASP .Net
    Replies:
    1
    Views:
    945
    Sriram Srivatsan
    Aug 12, 2008
  6. Adam Monsen

    JDBC URLs ...not really URLs?

    Adam Monsen, Feb 6, 2009, in forum: Java
    Replies:
    11
    Views:
    7,498
    Adam Monsen
    Feb 8, 2009
  7. Steve T.

    dynamic URLS convert to static URLS for search engines

    Steve T., Mar 1, 2004, in forum: ASP .Net Web Services
    Replies:
    7
    Views:
    580
    Steve T.
    Mar 4, 2004
  8. Ohad Lutzky

    Paths, gentleman, paths

    Ohad Lutzky, Nov 6, 2006, in forum: Ruby
    Replies:
    2
    Views:
    406
    David Vallner
    Nov 7, 2006
Loading...