Python Forum
Get the filename from a path
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Get the filename from a path
#1
I have a large text file which has a lot of links and I need python script to extract all the names of the files which end with .pdf format and sorted without repeated result ?

Example:

Quote:http://www.123.com/file.pdf http://www.123.com/pdfhello
http://www.456.com/hello/one.file.pdf http://www.123.com
http://www.456.com/hello/one.file.pdf

I need the final result to look like this:

file.pdf
one.file.pdf
Reply


Messages In This Thread
Get the filename from a path - by 12237ee1 - Jul-12-2020, 07:03 AM
RE: Get the filename from a path - by ndc85430 - Jul-12-2020, 07:08 AM
RE: Get the filename from a path - by DeaD_EyE - Jul-12-2020, 10:11 AM
RE: Get the filename from a path - by 12237ee1 - Jul-13-2020, 02:58 PM
RE: Get the filename from a path - by DeaD_EyE - Jul-13-2020, 04:10 PM
RE: Get the filename from a path - by 12237ee1 - Jul-13-2020, 06:01 PM
RE: Get the filename from a path - by Yoriz - Jul-12-2020, 10:33 AM
RE: Get the filename from a path - by DeaD_EyE - Jul-12-2020, 11:41 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  WebDriverException: Message: 'PATH TO CHROME DRIVER' executable needs to be in PATH Led_Zeppelin 1 2,281 Sep-09-2021, 01:25 PM
Last Post: Yoriz
  .pth file does not show up in sys.path when configuring path. arjunsingh2908 2 5,898 Jul-03-2018, 11:16 AM
Last Post: arjunsingh2908
  scandir() recursively and return path + filename malonn 6 17,660 May-09-2018, 03:45 PM
Last Post: wavic

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020