os.getcwd():获取当前工作目录。current_directory = os.getcwd()print(current_directory)os.chdir(path):改变当前工作目录。os.chdir('new_directory')os.listdir(path):列出指定目录下的所有文件和子目录。files = os.listdir('folder')print(files)os.mkdir(path):创建一个新的目录。os.mkdir('new_folder')os.rmdir(path):删除一个空目录。os.rmdir('empty_folder')os.remove(path):删除指定的文件。os.remove('file.txt')os.path.exists(path):检查指定的路径是否存在。if os.path.exists('path/to/file'):print('Path exists')else:print('Path does not exist')os.path.isfile(path):检查指定的路径是否为文件。if os.path.isfile('file.txt'):print('It is a file')else:print('It is not a file')os.path.isdir(path):检查指定的路径是否为目录。if os.path.isdir('folder'):print('It is a directory')else:print('It is not a directory')