remove strings containing only white spaces from list,l = [x for x in l if x.strip()]