Answers for "python remove extension from filenames list"

0

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'
Posted by: Guest on June-23-2021

Code answers related to "python remove extension from filenames list"

Python Answers by Framework

Browse Popular Code Answers by Language