Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python using os module file name from file path

import os

# file name with extension
file_name = os.path.basename('/root/file.ext')

# file name without extension
print(os.path.splitext(file_name)[0])
Source by www.programiz.com #
 
PREVIOUS NEXT
Tagged: #python #os #module #file #file #path
ADD COMMENT
Topic
Name
1+9 =