The .format()
method is a newer formatting method that should be preferrerd over %
-style formatting. In this lesson, you’ll learn when you should use it, how to produce powerful format strings without complicating simpler use cases, and how to format an int variable as a hexadecimal string:
>>> 'Hey, {name}, there is a 0x{errno:x} error'.format(name=name, errno=errno)
'Hey Bob, there is a 0xbadc0ffee error!'
nmsandy on Aug. 28, 2019
with all tutorial in the python 3