Using multiple arguments for string formatting in Python (e.g., ‘%s … %s’)

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 up with this:

'%s in %s' % unicode(self.author),  unicode(self.publication)

But this doesn’t work so how does it look in Python?

8 Answers
8
{"cc_re__cc_re__cc_by_sa_4_0": ["tag-link-position-25\" style=\"font-size: 11.71875pt;\" aria-label=\"wp-query (1,049 items)\">wp-query</a></p></div></div>\n</aside>\t</div>\n</div>\n\n\t</div>\n</div>\n\n\n<div class=\"site-footer\">\n\t\t\t\t<div id=\"footer-widgets\" class=\"site footer-widgets\">\n\t\t\t\t<div class=\"footer-widgets-container grid-container\">\n\t\t\t\t\t<div class=\"inside-footer-widgets\">\n\t\t\t\t\t\t\t<div class=\"footer-widget-1\">\n\t\t<aside id=\"block-16\" class=\"widget inner-padding widget_block\"><div class=\"creative-commons\"><div class=\"license-text\"><a href=\"http://creativecommons.org/licenses/by-sa/4.0/\" rel=\"license\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter\" style=\"border-width: 0;\" src=\"https://bootpanic.com/wp-content/uploads/2022/03/common_license.png\" alt=\"Creative Commons License\" width=\"98\" height=\"34\"/></a><br/>This work is licensed under a <a href=\"http://creativecommons.org/licenses/by-sa/4.0/\" rel=\"license\">Creative Commons Attribution-ShareAlike 4.0 International License</a>.</div><div>Content from: <a href=\"https://stackexchange.com/\">Stack Exchange</a></div></div></aside>\t</div>\n\t", "ide-footer-widgets\">\n\t\t\t\t\t\t\t<div class=\"footer-widget-1\">\n\t\t<aside id=\"block-16\" class=\"widget inner-padding widget_block\"><div class=\"creative-commons\"><div class=\"license-text\"><a href=\"http://creativecommons.org/licenses/by-sa/4.0/\" rel=\"license\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter\" style=\"border-width: 0;\" src=\"https://bootpanic.com/wp-content/uploads/2022/03/common_license.png\" alt=\"Creative Commons License\" width=\"98\" height=\"34\"/></a><br/>This work is licensed under a <a href=\"http://creativecommons.org/licenses/by-sa/4.0/\" rel=\"license\">Creative Commons Attribution-ShareAlike 4.0 International License</a>.</div><div>Content from: <a href=\"https://stackexchange.com/\">Stack Exchange</a></div></div></aside>\t</div>\n\t\t<div class=\"footer-widget-2\">\n\t\t<aside id=\"nav_menu-3\" class=\"widget inner-padding widget_nav_menu\"><h2 class=\"widget-title\">Important Link</h2><div class=\"menu-widget-menu-container\"><ul id=\"menu-widget-menu\" class=\"menu\"><li id=\"menu-item-270\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-"], "copyright__copyright__copyright": ["Using multiple arguments for string formatting in Python (e.g., \u2018%s \u2026 %s\u2019)\n\nI 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 up with this:\n\n'%s in %s' % unicode(self.author),  unicode(self.publication)\n\nBut this doesn\u2019t work so how does it look in Python?\n\n8 Answers\n8", "Using multiple arguments for string formatting in Python (e.g., \u2018%s \u2026 %s\u2019)\n\nI 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 up with this:\n\n'%s in %s' % unicode(self.author),  unicode(self.publication)\n\nBut this doesn\u2019t work so how does it look in Python?\n\n8 Answers\n8", "Using multiple arguments for string formatting in Python (e.g., \u2018%s \u2026 %s\u2019)\n\nI 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 up with this:\n\n'%s in %s' % unicode(self.author),  unicode(self.publication)\n\nBut this doesn\u2019t work so how does it look in Python?\n\n8 Answers\n8", "Using multiple arguments for string formatting in Python (e.g., \u2018%s \u2026 %s\u2019)\n\nI 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 up with this:\n\n'%s in %s' % unicode(self.author),  unicode(self.publication)\n\nBut this doesn\u2019t work so how does it look in Python?\n\n8 Answers\n8"]}