Format() method in Python Built in Function
Format method in built in function formats a specified value which is controlled format specifier.
Syntax:
format(value[, format_spec])
Parameter
Format method has two parameters.
- Value: this is the parameter which need to be formatted
- Format spec:this is the specification on how the value should be formatted.
Example-1:
x = format(0.5, '%') print(x)
Output:
Using percentage in format method

Example-2:
Using integer in format method
print(format(123, "d"))
Output:

Example-3:
Using float in format method
print(format(123.4567898, "f"))
Output:

Example-4:
Using binary in format method
print(format(12, "b"))
Output:

Example-5
print(format(1234, "*>+7,d"))
Output:
