'' is equivalent to False. If we filter the output of 0 (because 0 is equivalent to False), we can use list comprehension:
[x for x in a if x or x == 0]
Or, if we strictly want to filter out empty lines :
[x for x in a if x != '']
This may not be the fastest way.
Edit , added some scanner results compared to other solutions (not for the sake of comparison with others, but I was curious which method was the fastest)
ragsagar> 6.81217217445 pistache> 1.0873541832 cerealy> 1.07090902328 Matt> 1.40736508369 Ashwini Chaudhary> 2.04662489891 Phil H (just the generator) > 0.935978889465 Phil H with list() > 3.58926296234
I quickly made a script using timeit (), I used [0,1,2,0,3,4,'',5,8,0,'',4] as a list. I conducted several tests, the results did not change.
NOTE. I am not trying to use my solution from above, using speed as a criterion. I know that the OP didnβt specifically request speed, but I was curious and, possibly, some others.