Remove Part of String Before the Last Forward Slash

后端 未结 6 1947
终归单人心
终归单人心 2021-02-05 19:04

The program I am currently working on retrieves URLs from a website and puts them into a list. What I want to get is the last section of the URL.

So, if the first elemen

6条回答
  •  执笔经年
    2021-02-05 19:50

    This should work if you plan to use regex

     for link in link_list:
        file_names.append(link.replace('.*/',''))
     print(file_names)
    

提交回复
热议问题