📜  从 url python 代码示例获取文件名

📅  最后修改于: 2022-03-11 14:45:23.790000             🧑  作者: Mango

代码示例1
import os
from urllib.parse import urlparse

url = "http://photographs.500px.com/kyle/09-09-201315-47-571378756077.jpg"
a = urlparse(url)
print(a.path)                    # Output: /kyle/09-09-201315-47-571378756077.jpg
print(os.path.basename(a.path))  # Output: 09-09-201315-47-571378756077.jpg