I have a YAML file called input.yaml
:
---
'001':
name: Ben
email: ben@test.com
'002':
name: Lisa
email: lisa@test.com
'003':
name: Alex
email: alex@test.com
.
.
.
I have a dictionary:
my_dict = {'001': '000-111-2222', '002': '000-111-2223', '003': '000-111-2224', ...}
I would like to have an updated file called output.yaml
that looks like this:
---
'001':
name: Ben
email: ben@test.com
phone: 000-111-2222
'002':
name: Lisa
email: lisa@test.com
phone: 000-111-2223
'003':
name: Alex
email: alex@test.com
phone: 000-111-2224
.
.
.
Note how the output file has the "phone" field added with the value coming from the dictionary value of the matching key.
How do I get such file? ... I have tried all sorts.