Python 2D list slicing where one list is full of empty strings

  list, python, python-3.x

So say I have a 2D list like:

[
  [
    "9743",
    "user3"
  ],
  [
    "435",
    "user2"
  ],
  [
    "5426",
    "user8"
  ],
  [
    "",
    ""
  ],
  [
    "9743",
    "user9"
  ]
]

Where the index of that list of empty strings is unknown. Is there an easy way to slice the list so that everything after and including that list with empty strings is removed just keeping the stuff before it?

Source: Python-3x Questions

LEAVE A COMMENT