Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# create empty list
empty_lst = []
# multiple nested loops to store all post in empty list
for dct in data:
for k, v in dct.items():
if k == 'data':
if len(v) > 0:
for k_i, v_i in v[0].items():
if k_i == 'post':
empty_lst.append(v_i)
print("This is the empty list: ", empty_lst)
print("\nLength of list: ", len(empty_lst))
for i in empty_lst:
print(i)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment