TypeError: string indices must be integers
whilst processing a list of data in Python, where said data was being read from a YAML file.
It took me a while to work out the problem/solution.
Long story very short, lists in YAML are different to key/value pairs in that lists do NOT have a key, but instead have an index.
Therefore, the YAML needs to look like: -
number:
- 1
- 2
- 3
or: -
name:
- Lisa
- Marge
- Bart
- Homer
Once I changed my YAML, we were good to go.
These also helped: -
No comments:
Post a Comment