forgot this missive....
*args would require some field names of indeterminate length
ie prn(!A!, !b!, !cc!, !d!) as the expression
a, b, c, d = ['a', '', 'c', 'd']
def prn(*args):
"""demo replace the letters with !YourFieldName!
"""
vals = [i for i in args if i not in ("", " ", None)]
frmt = ("{}\n"*len(vals)).format(*vals)
return frmt
print(prn(a, b, c, d))
a
c
d
print(prn(a))
a
print(prn(a, d, c, b))
a
d
c
But if you want to change the separator, you can use this variant
def prn(*args, sep="..."):
"""demo replace the letters with !YourFieldName!
"""
vals = [f"{i}"+sep for i in args if i not in ("", " ", None)]
frmt = ("{}"*len(vals)).format(*vals)
return frmt
prn(a, c, d)
'a...c...d...'