'spam\\bacon\\eggsnote that the convention for importing pathlib is to run from pathlib import pathsince otherwise we' have to enter pathlib path everywhere path shows up in our code not only is this extra typing redundantbut it' also redundant ' running this interactive shell examples on windowsso path('spam''bacon''eggs'returned windowspath object for the joined pathrepresented as windowspath('spam/bacon/eggs'even though windows uses backslashesthe windowspath representation in the interactive shell displays them using forward slashessince open source software developers have historically favored the linux operating system if you want to get simple text string of this pathyou can pass it to the str(functionwhich in our example returns 'spam\\bacon\\eggs(notice that the backslashes are doubled because each backslash needs to be escaped by another backslash character if had called this function onsaylinuxpath(would have returned posixpath object thatwhen passed to str()would have returned 'spam/bacon/eggs(posix is set of standards for unix-like operating systems such as linux these path objects (reallywindowspath or posixpath objectsdepending on your operating systemwill be passed to several of the file-related functions introduced in this for examplethe following code joins names from list of filenames to the end of folder' namefrom pathlib import path myfiles ['accounts txt''details csv''invite docx'for filename in myfilesprint(path( ' :\users\al'filename) :\users\al\accounts txt :\users\al\details csv :\users\al\invite docx on windowsthe backslash separates directoriesso you can' use it in filenames howeveryou can use backslashes in filenames on macos and linux so while path( 'spam\eggs'refers to two separate folders (or file eggs in folder spamon windowsthe same command would refer to single folder (or filenamed spam\eggs on macos and linux for this reasonit' usually good idea to always use forward slashes in your python code (and 'll be doing so for the rest of this the pathlib module will ensure that it always works on all operating systems note that pathlib was introduced in python to replace older os path functions the python standard library modules support it as of python but if you are working with legacy python versionsi recommend using pathlib which gives you pathlib' features on python appendix has instructions for installing pathlib using pip whenever 've replaced an older os path function with pathlibi've made short note you can look up the older functions at reading and writing files