Answers for "remove extension filename in a list python"

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 "remove extension filename in a list python"

Python Answers by Framework

Browse Popular Code Answers by Language