import os
      os.path.relpath(directory, base_directory)
      Python language logo

      Get relative path

      Python public recipes

      The os.path.relpath() function returns the relative path to a file or directory. In this case, it returns the path to the /etc/passwd file.

      Shortcut: file.path.relative


        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.