You can use f-string and join methods in combination in Python as shown below:
main.py118 chars4 lines
In the above example, we have created a list of fruits named my_list
. We have then used the .join()
method to join the contents of the list with a separator of /
. Then, we have used f-string to include this result string in another string.
Output:
main.py40 chars2 lines
Here, the output consists of the list of fruits separated by /
.
gistlibby LogSnag