On this page
  1. posixpath.commonpath
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

posixpath.commonpath

Prev: posixpath.basename | Up: posixpath | Next: posixpath.commonprefix
Rel: posixpath.abspath, posixpath.basename, posixpath.commonprefix, posixpath.dirname
Ref: docs.python.org — posixpath.commonpath
Tags: #public #python3 #stdlib #posixpath


Import

import posixpath
from posixpath import commonpath

Signature & Overview

posixpath.commonpath(paths)

Given a sequence of path names, returns the longest common sub-path.

Usage

import posixpath

assert posixpath.commonpath(['/usr/lib', '/usr/local']) == '/usr'

Gotchas

REPL Inspect

from posixpath import commonpath
help(commonpath)

Linked from

Related notes