
How to Use Python Pathlib
Python Tip: Use pathlib to work with paths.
Here is an example 👇
from pathlib import Path
path = Path('/home/user/file.txt')
print(path.parent) # /home/user
print(path.stem) # file
print(path.suffix) # .txt