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

posixpath.basename

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


Import

import posixpath
from posixpath import basename

Signature & Overview

posixpath.basename(p)

Returns the final component of a pathname

Usage

import posixpath

assert posixpath.basename('/usr/local/bin/python3') == 'python3'

Gotchas

REPL Inspect

from posixpath import basename
help(basename)

Linked from

Related notes