The json module handles only a fixed set of Python types. To serialize complex numbers, dates, paths, or user-defined classes you must supply a default function or subclass JSONEncoder, then pair the output with object_hook on the decode side.
json / serialization / JSONEncoder / default / object_hook / python-standard-library / datetime / complex
How to read, modify, and synchronize environment variables in Python using os.environ and os.environb, handle encoding differences across platforms, and pass environment to child processes.
os.environ / os.environb / environment-variables / python-os / utf8-mode / cross-platform / child-process / reload_environ
Distinguish missing and empty settings, parse ports and booleans explicitly, and report configuration errors without exposing secrets.
Python / Configuration / Environment / Validation
Use ISO timestamp strings and decimal strings, then reconstruct the fields explicitly. A complete standard-library example shows timezone checks, precision and predictable failures.
JSON / Serialization / Deserialization / Datetime / Decimal / Python / Data Contract / Type Handling
Learn how to parse JSON data in Python from both string literals and files, and how to effectively handle potential decoding errors using the built-in json module.
python / json / parsing / decoding / file handling / error handling / pathlib / data serialization
A practical guide to using pathlib for file existence checks, extension manipulation, directory navigation, and path resolution without introducing platform-specific bugs on Windows or Unix systems.
pathlib / cross-platform / python / file-system / os.PathLike / PurePath / glob / resolve
A guide to using the Python csv module to automatically detect delimiters, handle Unicode Byte Order Marks (BOM) with utf-8-sig, and manage platform-specific newline issues using the Sniffer class and correct file opening parameters.
python / csv / data-processing / encoding / utf-8-sig / automation
How Python resolves relative paths depends on the process working directory, which varies by launcher. This guide shows how to inspect the working directory, choose and document an explicit path base, and understand why __file__ cannot always be trusted.
Python / pathlib / relative paths / working directory / __file__ / os.getcwd