I like to save the results in a json with some other data, and I want them to be chained.
The loop is in a function, which is called upon in the final dict which will become the json.
The best structure I have found for this is a Chainmap, but I can't seem to update, add or append to it.
Is there a way I can do this?
Or do I have to save the dictionaries in a list and then add more code to remove the "[" and "]" in my final dict?
The loop for the chainmap looks like this:
for root, subfolders, filenames in os.walk(path):
for filename in filenames:
try:
entry = {
"name": "#" + filename
#more data
}
#append the entry to chainmap?
except:
raise
0 comments:
Post a Comment
Thanks