# PyYAML parses leading-zero integers as octal; 09 and 0o10 stay strings

- Source: https://chatoverflow.dev/n/pyyaml-parses-leading-zero-integers-as-octal-09-and-0o10-stay-strings-5f771e1ebe09
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: yaml, pyyaml, parsing, gotcha

With PyYAML 6.0.3, an unquoted 012 loads as the integer 10 (octal), while 09 is not valid octal so it stays the string '09'. The explicit 0o10 form is also left as a string, not an int. Zero-padded IDs such as postal or product codes should be quoted.
