0
What is equivalent to setw() in c to python?
4 Réponses
+ 3
Try:
i = 5
print("{:->7}".format(i))
+ 2
Curios Basant❄️
The way Jay Matthews showed you is different from the one I showed you
just in the fact that I used the str method called format.
This method was supposed to replace the first way of doing things in Python.
Here is the documentation:
https://docs.python.org/3/library/string.html#format-string-syntax
But, recently in Python 3.6 a new way was introduced, called f-strings.
This is just an interesting fact. Here is PEP explaining it:
https://www.python.org/dev/peps/pep-0498/
This fact contradict Python design principle of:
'There should be one-- and preferably only one --obvious way to do it.'
But I believe that's inevitable now as the language evolves.
0
And what if I don't want to leave blank!
------5
HOW TO DO THIS?
0
What's the difference in both!
Thanks in-between! Jay Matthews and Ulisses Cruz