From the docs:
path may be a path-like object. If path is of type bytes (directly or indirectly through the PathLike interface), the filenames returned will also be of type bytes; in all other circumstances, they will be of type str.
Not sure about all the other functions you are referring to
CLICK HERE to find out more related problems solutions.