how to put a condition for a string to display or not code example
Example 1: how to put a condition for a string to display or not
>>> gender= "male"
>>> print "At least, that's what %s told me." %("he" if gender == "male" else "she")
At least, that's what he told me.
Example 2: how to put a condition for a string to display or not
>>> s = "At least, that's what {pronoun} told me.".format(pronoun="he" if gender == "male" else "she")
>>> s
"At least, that's what he told me."