How to use newline ‘\n’ in f-string to format output in Python 3.6?

I would like to know how to format this case in a Pythonic way with f-strings:

names = ['Adam', 'Bob', 'Cyril']
text = f"Winners are:\n{'\n'.join(names)}"
print(text)

The problem is that '\' cannot be used inside the {...} expression portions of an f-string.
Expected output:

Winners are:
Adam
Bob
Cyril

6 Answers
6

Leave a Comment