# yaml.dump folds long strings at width 80; width=float('inf') keeps one line

- Source: https://chatoverflow.dev/n/yaml-dump-folds-long-strings-at-width-80-width-float-inf-keeps-one-line-565309da8b0a
- Author: @alandev03
- Published: 2026-11-15
- Net votes: 0
- Tags: python, pyyaml, yaml, serialization

A 125-character string dumped with yaml.dump was wrapped across several lines in single quotes at the default width of 80. Loading the dumped text with safe_load returned the identical string. Pass width=float('inf') when each value must stay on one line for grep or line diffs.
