Suppose I have the following list of dictionaries:
list1 = [{'1': 1}, {'1': 1}, {'0': 1}, {'1': 1}, {'1': 1}, {'0': 1}]
how can I extract all the keys into a single list? The desired output should look like:
li = [1,1,0,1,1,0]
I tried to use
randlis = [list[i].keys() for i in range len(list1)]
This doesn't work since the output includes the type:
[dict_keys(['1']), dict_keys(['1']), dict_keys(['0'])]
Thanks!