The format()
function is a built-in function in Python that returns a formatted representation of a value controlled by a format specifier. This method is created to handle complex string formatting more efficiently.
Returns: It returns the formatted representation of the value controlled by the format specifier.
format(valuee[, format_specifier])
From the above syntax, we can say that the format()
function takes two parameters, value
(the value that needs to be formatted) and format_specifier
(the specification of how the value needs to be formatted).
print(format(255.4226,"f")) #float argumentprint(format(365,"d")) #integerprint(format(45,"b")) #binary argument