Advertisement
horozov86

Extract File

Mar 20th, 2023
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.29 KB | None | 0 0
  1. path = input()
  2. path_split = path.split("\\")
  3.  
  4. path_file_name_ext = path_split[-1]
  5. path_file_name_ext_split = path_file_name_ext.split(".")
  6.  
  7. file_name = path_file_name_ext_split[0]
  8. extension = path_file_name_ext_split[1]
  9.  
  10. print(f"File name: {file_name}")
  11. print(f"File extension: {extension}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement