String Formatting with %


#1

In Lesson #14 String Formatting with %

string_1 = "Camelot"
string_2 = “place”

print “Let’s not go to %s. 'Tis a silly %s.” % (string_1, string_2)

How does the print command know which string goes with which “%s”? Is it because it is number “string_1, string_2”?


#2

They just go in the same order. string_1 goes to the first %s and string_2 to the second %s.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.