Python guides
Every published Python guide, newest first, with practical examples you can copy into your own project.
3,965 guides across 14 topics
Topics
Popular Python guides
Most readLatest Python guides
Page 7 of 179Configuring a Jinja2 Environment with FileSystemLoader and Autoescape in Python
Use Jinja2's FileSystemLoader to load templates from disk, enable autoescape so HTML output is escaped by default, and handle template loading errors.
Python Jinja2 Custom Filters and Macros
Learn how to create custom filters and macros in Python Jinja2 templates. Includes syntax, practical examples, macro imports, and guidance on when to use each.
Python Jinja2 Templates: Variables, Loops, and Conditions
Learn how Jinja2 variables, for loops, and if conditions work in Python templates, including filters, undefined-variable handling, whitespace control, and performance tips.
Parsing Nested XML and Attributes with Python xmltodict
Learn how to use xmltodict to parse nested XML into dictionaries, read attributes with the @ prefix, handle repeated elements and namespaces, and write XML back out.
Convert XML to Dictionary and Back with Python xmltodict
Learn how to use Python's xmltodict to convert XML to dictionaries and back, including attribute handling, namespaces, round-trip limitations, and when to prefer ElementTree.
Python msgpack vs JSON: Choosing a Serialization Format
python msgpack vs json: Compare Python msgpack and JSON for serialization: data types, performance, compatibility, and practical guidance for choosing the right format.
Python msgpack: Serialize and Deserialize Python Objects
Learn how to use the Python msgpack library to serialize and deserialize objects: core API, type mapping, custom classes, limitations, and safety.
Python orjson vs json performance: API differences
Compare Python's standard json module with orjson: API differences, type support, and performance tradeoffs that matter in production.
Python orjson: Serializing Dataclasses with datetime, numpy, and pydantic
python orjson datetime dataclass numpy and pydantic: Learn how to serialize Python dataclasses with datetime and numpy types using orjson, and how pydantic models fit...
Python orjson: dumps, loads, and serialization options
Use Python's orjson library for fast JSON serialization. Learn orjson.dumps and orjson.loads options, dataclass support, datetime and UUID handling, and key differences from the standard json module.