I have a string that looks like \'%s in %s\'
and I want to know how to seperate the arguments so that they are two different %s. My mind coming from Java came u
You must just put the values into parentheses:
'%s in %s' % (unicode(self.author), unicode(self.publication))
Here, for the first %s
the unicode(self.author)
will be placed. And for the second %s
, the unicode(self.publication)
will be used.
Note: You should favor
string formatting
over the%
Notation. More info here