0
Why we put "!r" inside the code ?
Here is the code I found, but I can't understand why there's "!r" inside, and what's it meaning: class Pizza: def __init__(self, ingredients): self.ingredients = ingredients def __repr__(self): return f'Pizza({self.ingredients!r})' # here, there's a "!r" after "self.ingredients"
1 Answer
+ 5
It uses repr on a value supplied. Take a look for more:
https://stackoverflow.com/questions/44800801/in-a-JUMP_LINK__&&__python__&&__JUMP_LINK-format-string-what-does-r-mean