name of the filefoo txt closed or not false opening mode wb softspace flag directories in this python directory tutorialwe will import the os module to be able to access the methods we will apply import os how to get current python directoryto find out which directory in python you are currently inuse the getcwd(method os getcwd(output' :\\users\\lifei\\appdata\\local\\programs\\python\\python - cwd is for current working directory in python this returns the path of the current python directory as string in python to get it as bytes objectwe use the method getcwdb(os getcwdb(outputb' :\\users\\lifei\\appdata\\local\\programs\\python\\python - herewe get two backslashes instead of one this is because the first one is to escape the second one since this is string object type(os getcwd()to render it properlyuse the python method with the print statement print(os getcwd()