Hi,
Quite often in the last years, I’ve seen situations in which we would need !a!b!c!
as output from a list L = ['a', 'b', 'c']
, here with separator='!'
, but it could be with any separator.
I’ve seen people using:
-
separator + separator.join(L) + separator
-
separator.join([""] + L + [""])
Proposal: what do you think about
-
separator.join(L)
givea!b!c
as usual -
separator.join(L, prefix=True)
give!a!b!c
-
separator.join(L, suffix=True)
givea!b!c!
-
separator.join(L, prefix=True, suffix=True)
give!a!b!c!
or something similar (with another names) to have cleaner code and avoid the repetition of separator
?