python join empties string code example
Example 1: python join list ignore none and empty string
>>> strings = ['foo','','bar','moo']
>>> ' '.join(filter(None, strings))
'foo bar moo'
Example 2: python join multiple strings ignore none and empty string
# Concatenates string variables a and b with ' - ' or Coalesces them if one is None
'-'.join([x for x in (a,b) if x])