怎么使用python实现文件路径和url相互转换?
baby不要哭泣
baby不要哭泣 2017-02-14 09:30:52
0
2
932

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

baby不要哭泣
baby不要哭泣

reply all(2)
数据分析师

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\


Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!