I want to split or separate this list wherever there is an empty list []
Sample list:
lists = [['I'], ['speak'], ['english'], [], ['I'], ['speak'], ['spanish'], [], ['I'], ['speak'], ['Hindu']]
Desired output:
lists = [
[['I'], ['speak'],['english']],
[['I'], ['speak'],['spanish']],
[['I'], ['speak'],['Hindu']],
]
How do I achieve this?
I've tried:
new_list = []
for I in range(len(lists)):
temp_list = []
if lists[i] != []:
temp_list.append(lists [i])
new_list.append(temp_list)