On this page
fileinput.hook_encoded
Prev: fileinput.hook_compressed | Up: fileinput | Next: fileinput.input
Rel: fileinput.close, fileinput.FileInput, fileinput.filelineno, fileinput.filename
Ref: docs.python.org — fileinput.hook_encoded
Tags: #public #python3 #stdlib #fileinput
Import
import fileinput
from fileinput import hook_encoded
Signature & Overview
fileinput.hook_encoded(encoding, errors=None)
fileinput.hook_encoded() function.
Usage
import fileinput
hook = fileinput.hook_encoded("utf-8", errors="replace")
assert callable(hook)
Gotchas
- Pass
encoding=directly tofileinput.input()in Python 3.10+:hook_encoded()is mostly for older Python compatibility.
REPL Inspect
from fileinput import hook_encoded
help(hook_encoded)
Linked from
Related notes
- tuts/python3/stdlib_module/fileinput/hook_compressed Linked here; links to this page; shared tags: #fileinput, #stdlib
- tuts/python3/stdlib_module/fileinput/input Linked here; links to this page; shared tags: #fileinput, #stdlib
- tuts/python3/stdlib_module/fileinput/close Linked here; shared tags: #fileinput, #stdlib
- tuts/python3/stdlib_module/fileinput/FileInput Linked here; shared tags: #fileinput, #stdlib
- tuts/python3/stdlib_module/fileinput/filelineno Linked here; shared tags: #fileinput, #stdlib
- tuts/python3/stdlib_module/fileinput/filename Linked here; shared tags: #fileinput, #stdlib
- tuts/python3/stdlib_module/fileinput links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/fileinput/fileno shared tags: #fileinput, #stdlib
- tuts/python3/stdlib_module/fileinput/isfirstline shared tags: #fileinput, #stdlib
- tuts/python3/stdlib_module/fileinput/isstdin shared tags: #fileinput, #stdlib