Список соединений Python не игнорируйте и не пустую строку
>>> strings = ['foo','','bar','moo']
>>> ' '.join(filter(None, strings))
'foo bar moo'
Breakable Bee
>>> strings = ['foo','','bar','moo']
>>> ' '.join(filter(None, strings))
'foo bar moo'
# Concatenates string variables a and b with ' - ' or Coalesces them if one is None
'-'.join([x for x in (a,b) if x])