examplethis code will create spam folder under the home folder on my computerfrom pathlib import path path( ' :\users\al\spam'mkdir(note that mkdir(can only make one directory at timeit won' make several subdirectories at once like os makedirs(handling absolute and relative paths the pathlib module provides methods for checking whether given path is an absolute path and returning the absolute path of relative path calling the is_absolute(method on path object will return true if it represents an absolute path or false if it represents relative path for exampleenter the following into the interactive shellusing your own files and folders instead of the exact ones listed herepath cwd(windowspath(' :/users/al/appdata/local/programs/python/python 'path cwd(is_absolute(true path('spam/bacon/eggs'is_absolute(false to get an absolute path from relative pathyou can put path cwd(in front of the relative path object after allwhen we say "relative path,we almost always mean path that is relative to the current working directory enter the following into the interactive shellpath('my/relative/path'windowspath('my/relative/path'path cwd(path('my/relative/path'windowspath(' :/users/al/appdata/local/programs/python/python /my/relativepath'if your relative path is relative to another path besides the current working directoryjust replace path cwd(with that other path instead the following example gets an absolute path using the home directory instead of the current working directorypath('my/relative/path'windowspath('my/relative/path'path home(path('my/relative/path'windowspath(' :/users/al/my/relative/path'