Answers for "pathlib get extension"

1

split filename and extension python

>>> import os
>>> filename, file_extension = os.path.splitext('/path/to/somefile.ext')
>>> filename
'/path/to/somefile'
>>> file_extension
'.ext'
Posted by: Guest on April-01-2020
0

pathlib get extension

from pathlib import Path
Path("/path/to/file.txt").suffix
Posted by: Guest on November-04-2021

Code answers related to "pathlib get extension"

Python Answers by Framework

Browse Popular Code Answers by Language