Need to turn several strings into one readable value? Call join on the delimiter, not on the list: separator.join(iterable). Python inserts the calling string between adjacent elements, and the iterable can be a list, tuple, set, dictionary, map object, or another iterable. section 2.3.2
Format a style setting
style_settings = ["font-size=large", "font=Arial", "color=black", "align=center"] merged_style = ", ".join(style_settings) print(merged_style) # output: font-size=large, font=Arial, color=black, align=center section 2.3.2
Choose the joining technique according to the shape of the task:
- Use join when individual strings are already stored in an iterable, especially when there are many of them. section 2.3.4
- Use concatenation for a small number of strings; consider f-strings first when bringing related strings together. section 2.3.4
- Remember the direction of the call: the separator joins each item in the iterable, rather than the iterable providing the method. section 2.3.2





