2/26/2023

split filename and dir using os.path.split

 refer to code


.

import os

path = '/Users/source_code/final_data/test/X51006647933.jpg'

# Split the path into directory name and file name
dirname, filename = os.path.split(path)

# Print the file name
print(filename) # Output: X51006647933.jpg

..


Thank you.

πŸ™‡πŸ»‍♂️

www.marearts.com

No comments:

Post a Comment