Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

remove extension from filename python

import os
base=os.path.basename('/root/dir/sub/file.ext')
print(base)
#'file.ext'
print(os.path.splitext(base))
#('file', '.ext')
print(os.path.splitext(base)[0])
#'file'
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #remove #extension #filename #python
ADD COMMENT
Topic
Name
9+9 =