-
-
Save amankharwal/2905e4a13842131520882134a3a04692 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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