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

os.fspath

Prev: os.fsencode | Up: os | Next: os.getcwd
Rel: os.abort, os.access, os.chdir, os.chmod
Ref: docs.python.org — os.fspath
Tags: #public #python3 #stdlib #os


Import

import os
from os import fspath

Signature & Overview

os.fspath(path)

Return the file system path representation of the object.

Usage

import os
from pathlib import Path

assert os.fspath(Path("a/b.txt")) == str(Path("a/b.txt"))
assert os.fspath("raw.txt") == "raw.txt"

Gotchas

REPL Inspect

from os import fspath
help(fspath)

Linked from

Related notes