I am looking for a clean way to combine variables into a single string with a predefined separator. The problem is that sometimes some of these variables wont always exist or can be set to None. I cant have the separator string duplicate either. Example of problem:
# This works because I have all strings
str('-').join(('productX', 'deployment-package', '1.2.3.4'))
# 'productX-deployment-package-1.2.3.4'
# But I have more args that might be None / or not exist like and that breaks
str('-').join(('productX', 'deployment-package', '1.2.3.4', idontexist, alsonotexist))
str('-').join(('productX', 'deployment-package', '1.2.3.4', None, None, None))
# If I set the other missing variables to empty strings, I get duplicated joiners
str('-').join(('productX', 'deployment-package', '1.2.3.4', '', '', ''))
# 'productX-deployment-package-1.2.3.4---'
Is there a nice clean way to do this?