What would be your preferred way to concatenate strings from a sequence such that between every two consecutive pairs a comma is added. That is, how do you map, for instance
>>> my_list = ['A', '', '', 'D', 'E',] >>> ",".join([str(i) for i in my_list if i]) 'A,D,E'
my_list may contain any type of variables. This avoid the result 'A,,,D,E'.
my_list
'A,,,D,E'