.format python3 code example
Example 1: print string python
str1 = "Hello World"
print(str1)
Example 2: str.format python 3
print("Sammy the {pr} {1} a {0}.".format("shark", "made", pr = "pull request"))
Example 3: format on str
'{} {}'.format('one', 'two')
Example 4: str.format python 3
print("Sammy ate {0:f} percent of a {1}!".format(75, "pizza"))
Example 5: .format python 3
#New Style
'{} {}'.format('one', 'two')
#Old Style
'%s %s' % ('one', 'two')