Python format() Function

The python format() function returns a formatted representation of the given value.

Signature

Parameters

value: It is the value that needs to be formatted.

format: It is the specification on how the value should be formatted.

Return

It returns a formatted representation of the given value.

Python format() Function Example 1

The below example shows a number of formatting with format().

Output:

123
123.456790
1100

Explanation: The above example returns a formatted representation of the values.






Latest Courses