0

What is equivalent to setw() in c to python?

4th May 2018, 8:37 AM
Çůřîöş ßąšäñț 🇮🇳
Çůřîöş ßąšäñț 🇮🇳 - avatar
4 ответов
+ 3
Try: i = 5 print("{:->7}".format(i))
4th May 2018, 9:26 AM
Ulisses Cruz
Ulisses Cruz - avatar
+ 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.
4th May 2018, 9:53 AM
Ulisses Cruz
Ulisses Cruz - avatar
0
And what if I don't want to leave blank! ------5 HOW TO DO THIS?
4th May 2018, 9:19 AM
Çůřîöş ßąšäñț 🇮🇳
Çůřîöş ßąšäñț 🇮🇳 - avatar
0
What's the difference in both! Thanks in-between! Jay Matthews and Ulisses Cruz
4th May 2018, 9:31 AM
Çůřîöş ßąšäñț 🇮🇳
Çůřîöş ßąšäñț 🇮🇳 - avatar