Why is There a Backslash Here?

print "Ah, so your name is %s, your quest is %s, " \
"and your favorite color is %s." % (name, quest, color)

why is there a slash after the first statement?what does it do?

FAQ: Learn Python – Strings & Console Output – String Formatting with %, Part 2

so your can put the code over two lines.


We’ve seen the backslash being used to display quotes (e.g. print ‘Python’s world’) and to create special characters (e.g. \t for TAB and \n for NEWLINE), but I think you should explicitly introduce this use of the backslash ‘’ character at the end of the line, as it’s the first use to break lines of code in this series of lessons.