Skip to content Skip to sidebar Skip to footer

Displaying And Iterating A List Within A String?

So I'm writing a program which part of it involves sending out an email. Within the email body (which is a string), I want to display a list. However, I want to know how/or what t

Solution 1:

Just join the list on newlines (or commas, or whatever you like) as you format it:

"""…booked for %s:

%s

Thank You, …""" % (newdate, "\n".join(formatted_times))

Post a Comment for "Displaying And Iterating A List Within A String?"