0
In String formating using %, What does here 5 means in 5.2f ?
I tried many examples with different number there in place of 5 but I didn't noticed any change.
4 Answers
+ 3
It's the width.
https://python-reference.readthedocs.io/en/latest/docs/str/formatting.html
Notice that this is an older style of formatting and is no longer recommended. Read more about it here:
https://realpython.com/python-string-formatting/
+ 2
Simon Sauter Thank you! Actually I'm trying to understand different way of formatting strings. I normally use str.format() or f-string
+ 1
Tushar Kumar đźđł
Can you give a working demonstration.