Answers for "formatting in python 2.7"

1

how to do formatting in python with format function

age = 36
txt = "his age is {}"
print(txt.format(age))
Posted by: Guest on December-22-2021
2

.format python 3

#New Style
'{} {}'.format('one', 'two')

#Old Style
'%s %s' % ('one', 'two')
Posted by: Guest on March-20-2021

Python Answers by Framework

Browse Popular Code Answers by Language