words = [['hey', 'hey you'], ['ok', 'ok no', 'boy', 'hey ma']]
I have a list of lists containing strings. I understand how to remove specific elements from a list, but not how to remove those that are only one word. My desired output would be:
final = [['hey you'], ['ok no', 'hey ma']]
What I'm trying but I think it's totally wrong....
remove = [' ']
check_list = []
for i in words:
tmp = []
for v in i:
a = v.split()
j = ' '.join([i for i in a if i not in remove])
tmp.append(j)
check_list.append(tmp)
print check_list
check_listoutputs the same aswords