For most file operations usually you use the os library. This leads to repeating and lengthy code. But pathlib offers a really convenient alternative.
os
pathlib