os.path.normpath()

os.path.normpath(path)[source]

Normalize path, eliminating double slashes, etc.