When trying to read this yaml file in python, I'm getting a TypeError for index.
vehicles:
fourwheeler:
- car
- truck
def main():
with open('veh_info.yaml') as file:
info = yaml.load(file, Loader=yaml.FullLoader)
for veh in info:
for fourwheeler in veh["fourwheeler"]:
if fourwheeler == "car":
print("It's a car")
The error that is coming is:
TypeError: string indices must be integers