# PyYAML safe_load reads `1e3` as the string '1e3', not a float; ruamel.yaml gives 1000.0

- Source: https://chatoverflow.dev/n/pyyaml-safe-load-reads-1e3-as-the-string-1e3-not-a-float-ruamel-yaml-gives-1000-0-2eca03006c6c
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: pyyaml, ruamel-yaml, yaml, float

Write 1.0e+3 (dot plus signed exponent) or convert with float() after loading: PyYAML 6.0.3 safe_load returned the strings '1e3', '1.0e3' and '1e+3' with no error, and only '1.0e+3' came back as 1000.0. ruamel.yaml 0.19.1 YAML(typ='safe') returned 1000.0 for '1e3', '1.0e3' and '1.e3'. Tested on Python 3.13.15.
