Python split url to find image name and extension

后端 未结 7 1973
逝去的感伤
逝去的感伤 2021-02-04 13:43

I am looking for a way to extract a filename and extension from a particular url using Python

lets say a URL looks as follows

picture_page = \"http://dis         


        
7条回答
  •  再見小時候
    2021-02-04 14:06

    filename = picture_page.split('/')[-1].split('.')[0]
    file_ext = '.'+picture_page.split('.')[-1]
    

提交回复
热议问题