you could add one to page files in another directoryif you need to run in different working directorycall the os chdir function to change to new directoryyour code will run relative to the new directory for the rest of the program (or until the next os chdir callthe next will have more to say about the notion of current working directoryand its relation to module imports when it explores script execution context portability constants the os module also exports set of names designed to make cross-platform programming simpler the set includes platform-specific settings for path and directory separator charactersparent and current directory indicatorsand the characters used to terminate lines on the underlying computer os pathsepos sepos pardiros curdiros linesep (';''\\''''\ \ 'os sep is whatever character is used to separate directory components on the platform on which python is runningit is automatically preset to on windowsfor posix machinesand on some macs similarlyos pathsep provides the character that separates directories on directory listsfor posix and for dos and windows by using such attributes when composing and decomposing system-related strings in our scriptswe make the scripts fully portable for instancea call of the form dir path split(os sepwill correctly split platform-specific directory names into componentsthough dirpath may look like dir\dir on windowsdir/dir on linuxand dir:dir on some macs as mentionedon windows you can usually use forward slashes rather than backward slashes when giving filenames to be openedbut these portability constants allow scripts to be platform neutral in directory processing code notice also how os linesep comes back as \ \ here--the symbolic escape code which reflects the carriage-return line-feed line terminator convention on windowswhich you don' normally notice when processing text files in python we'll learn more about end-of-line translations in common os path tools the nested module os path provides large set of directory-related tools of its own for exampleit includes portable functions for tasks such as checking file' type (isdirisfileand others)testing file existence (exists)and fetching the size of file by name (getsize)os path isdir( ' :\users')os path isfile( ' :\users'(truefalseos path isdir( ' :\config sys')os path isfile( ' :\config sys'(falsetrueos path isdir('nonesuch')os path isfile('nonesuch' system tools