【发布时间】:2020-06-26 05:55:00
【问题描述】:
我想从 Links Like this 2 Links 中提取图像名称
url1 = 'https://vignette.wikia.nocookie.net/warframe/images/1/17/AshNewLook.png/revision/latest?cb=20141124022921'
url2 = 'https://vignette.wikia.nocookie.net/warframe/images/b/b5/BaruukIcon272.png/revision/latest?cb=20181219151057'
我尝试使用 os.path.basename 但它不起作用
我只想从链接中提取图像名称
来自第 1 页的“AshNewLook.png”
'BaruukIcon272.png' 来自第 2 页
注意:链接在没有最后一部分的情况下有效
示例:
url1 = 'https://vignette.wikia.nocookie.net/warframe/images/1/17/AshNewLook.png/revision/latest?cb=20141124022921'
url2 = 'https://vignette.wikia.nocookie.net/warframe/images/1/17/AshNewLook.png'
url1 将打开与 url2 相同的页面
【问题讨论】:
-
请向我们展示您的尝试,并解释为什么以及如何没有成功。
标签: python url hyperlink filenames