Advertisement
simeonshopov

Extract File

Feb 11th, 2020
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.21 KB | None | 0 0
  1. path = input()[::-1]
  2. slash = path.find('\\')
  3. file = path[:slash][::-1]
  4. full_stop = file.find('.')
  5. name = file[:full_stop]
  6. extension = file[full_stop + 1:]
  7. print(f'File name: {name}\nFile extension: {extension}')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement