So I'm not a programmer, I took a few classes ages ago, but there are some Python scripts in use on the servers here so I figured I'd start.
What I'm trying to do is call an API and get a chunk of JSON data, then store it in a nested dictionary, as I iterate through a list of strings. (000, 001, 004, etc.) The API call and data storage is working fine (it's how I got the list to begin with), but I can't figure out how to add each API response to inhabit a separate "folder" in the dictionary.
So this is where I'm at, having banged my head against it for a day. The first loop works fine and creates a whole series of headers in the dictionary (so I know that works), but as soon as I start the second loop it removes them all, and as it adds each chunk of data from the API call it removes the previous one, so that by the end only the final header and its data are present. Is there any way to make this work, or would I be better off using separate dicts for each iteration?
What I'm trying to do is call an API and get a chunk of JSON data, then store it in a nested dictionary, as I iterate through a list of strings. (000, 001, 004, etc.) The API call and data storage is working fine (it's how I got the list to begin with), but I can't figure out how to add each API response to inhabit a separate "folder" in the dictionary.
So this is where I'm at, having banged my head against it for a day. The first loop works fine and creates a whole series of headers in the dictionary (so I know that works), but as soon as I start the second loop it removes them all, and as it adds each chunk of data from the API call it removes the previous one, so that by the end only the final header and its data are present. Is there any way to make this work, or would I be better off using separate dicts for each iteration?