What are the backslashes in the string?

Is there any way in which doing the method provided in this exercise:

'The poem \"{}\" is written by {}.'.format(title, poet)

is better than:

'The poem "%s" is written by %s.' % (title, poet)

The second method seems simpler to me. Am I missing something? Is there a scenario where .format() is better?

1 Like