words = ["a\n", "\n", "ok\n", "\n", ""]

print([word.strip() for word in words if word.strip() != ""])