怎么使用python实现文件路径和url相互转换?
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.
具体实现方法如下:
import urllib pathname = 'path/to/file/or/folder/' url = urllib.pathname2url(pathname) pathname = urllib.url2pathname(url) print pathname
运行结果如下:
path\to\file\or\folder\
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.
具体实现方法如下:
运行结果如下: