> For the complete documentation index, see [llms.txt](https://yunaeecy.gitbook.io/wiki/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://yunaeecy.gitbook.io/wiki/python/.2f.md).

# "{:.2f}"

python

"{:.2f}" is a string formatting syntax in Python that specifies the number of decimal places to display when formatting a floating-point number.&#x20;

The ".2f" specifies that the number should be formatted with **two decimal places**. For example, if you have a floating-point number x = 3.14159265, you can **limit it to two decimal points u**sing the format function as follows: y = "{:.2f}".format(x), which will return the value 3.14. Alternatively, you can use the f-string method to format the number as follows: y = f"{x:.2f}", which will also return the value 3.14[<br>](https://pythonhow.com/how/limit-floats-to-two-decimal-points/).
