search

Home  >  Q&A  >  body text

怎么使用python实现文件路径和url相互转换?

怎么使用python实现文件路径和url相互转换?

baby不要哭泣baby不要哭泣2861 days ago999

reply all(2)I'll reply

  • 数据分析师

    数据分析师2017-10-01 00:17:33

    How to use python to convert file path and url to each other? -PHP Chinese website Q&A-How to use python to convert file path and url to each other? -PHP Chinese website Q&A

    Let’s take a look and learn.

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-02-14 09:31:58

    具体实现方法如下:

    import urllib 
    pathname = 'path/to/file/or/folder/' 
    url = urllib.pathname2url(pathname) 
    pathname = urllib.url2pathname(url)
    print pathname

    运行结果如下:

    path\to\file\or\folder\


    reply
    0
  • Cancelreply