I am trying to get a list of the last value in each row of a csv file using python. The rows all have five cells, but they are inconsistently filled up. Some have one, two, three, or four cells filled with the rest empty. Here is an excerpt of the csv file:
art and entertainment,books and literature,,,
art and entertainment,celebrity fan and gossip,,,
art and entertainment,comics and animation,anime and manga,,
art and entertainment,comics and animation,cartoons,,
art and entertainment,comics and animation,comics,,
art and entertainment,dance,ballet,,
art and entertainment,dance,ballroom dance,,
art and entertainment,dance,belly dance,,
art and entertainment,dance,modern dance,,
art and entertainment,dance,pole dancing,,
art and entertainment,dance,,,
art and entertainment,humor,,,
art and entertainment,movies,film festivals and awards,,
...
and the desired output:
books and literature, celebrity fan and gossip, anime and manga, cartoons, comics, ballet, ...
question from:
https://stackoverflow.com/questions/65905199/reading-last-non-empty-cell-in-row-of-csv-file-with-python