0
Format characters have to be specified? for example:
x = "Get rekt m8"
print "Eu disse: %r." % x
So why didn’t I need to specify this and it worked anyway?
hilarious = False
joke_evaluation = "Isn't that joke so funny?! %r"
0
Format characters have to be specified? for example:
x = "Get rekt m8"
print "Eu disse: %r." % x
So why didn’t I need to specify this and it worked anyway?
hilarious = False
joke_evaluation = "Isn't that joke so funny?! %r"
0
A string can be formatted at any time. The character % performs the formatting operation only when it is used as an operator. While this does not occur, the string in question can be manipulated and used without any problem.
https://docs.python.org/2/library/stdtypes.html#string-formatting
Since Python 2.6, there is a more powerful way to format strings:
https://docs.python.org/2/library/string.html#string-formatting
Browser other questions tagged python python-2.7
You are not signed in. Login or sign up in order to post.
What do you mean
esta funcionou? Can you describe what behavior you’re observing differently than you expected?– elias