Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Fancier Output Formatting in python

>>> yes_votes = 42_572_654
>>> no_votes = 43_132_495
>>> percentage = yes_votes / (yes_votes + no_votes)
>>> '{:-9} YES votes  {:2.2%}'.format(yes_votes, percentage)
' 42572654 YES votes  49.67%'
Source by docs.python.org #
 
PREVIOUS NEXT
Tagged: #Fancier #Output #Formatting #python
ADD COMMENT
Topic
Name
1+9 =