Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to get file name without extension in python

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