I'm trying to create a directory of folders and files for each user, and I can't seem to access a dictionary for a folder within a list of all of a user's files but only using the folder name, not by indexing.
I could iterate over the list and check if the element is a dictionary with the folder name I'm trying to access, but I felt like there was probably an easier way.
userDir = {"User1": [{"folder1": [file1, file2]}, file3], "User2": []}
What's the best way I could access the dictionary key "folder1" here?
userDir['User1'][1]this will give file3,userDir['User1'][0]['folder1']gets you to the list of file1 & file2 and this,userDir['User1'][0]['folder1'][0],gets you to file one in the dictionary, list, dictionary, list structure:"folder1"dictionary if you don't know which position it is inside the list of"User1"