[Answer]-Python – proper syntax of .format()

1👍

Just format the content first, and then add the django tags.

"{%" + " display_cookies_accepted {} ".format(self.client.cookies) + "%}"

Or put the tags in the format as well.

"{} display_cookies_accepted {} {}".format('{%', self.client.cookies, '%}')

Leave a comment