You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
That's correct YAML 1.1. PyYAML implements 1.1 only so far.
A leading zero means it's an octal value, so 07 or 010 are octal numbers. 08 and 09 however can't be octal numbers, so the quotes are redundant.
Related issues: #486 (other issues are linked from there)
You can use the following project on top of PyYAML for YAML 1.2 support: https://pypi.org/project/yamlcore/
Since integers in YAML 1.2 can start with zeroes, all strings will be quoted:
>>> import yamlcore
>>> y = yaml.dump(names, Dumper=yamlcore.CoreDumper)
>>> print(y)
- key: some_id
type: value
value:
- '04549'
- '24543'
I encountered an issue with preserving the single quote in output yaml file. Here is a simple example:
The output yaml will display the following:
Notice that the single quote around 04959 is not preserved. Does anyone know how to fix it? Thanks.
The text was updated successfully, but these errors were encountered: