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

posixpath.split

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


Import

import posixpath
from posixpath import split

Signature & Overview

posixpath.split(p)

Split a pathname. Returns tuple "(head, tail)" where "tail" is everything after the final slash. Either part may be empty.

Usage

import posixpath

assert posixpath.split('/a/b/file.txt') == ('/a/b', 'file.txt')

Gotchas

REPL Inspect

from posixpath import split
help(split)

Linked from

Related notes