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

os.fsdecode

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


Import

import os
from os import fsdecode

Signature & Overview

os.fsdecode(filename)

Decode filename (an os.PathLike, bytes, or str) from the filesystem encoding with 'surrogateescape' error handler, return str unchanged. On Windows, use 'strict' error handler if the file system encoding is

Usage

import os

assert os.fsdecode(b"notes.txt") == "notes.txt"
assert os.fsdecode("notes.txt") == "notes.txt"

Gotchas

REPL Inspect

from os import fsdecode
help(fsdecode)

Linked from

Related notes