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