[Python] Fixed digits after decimal with f-strings

Discussão em 'Python' iniciado por Stack, Maio 29, 2025.

  1. Stack

    Stack Membro Participativo

    Is there an easy way with Python f-strings to fix the number of digits after the decimal point? (Specifically f-strings, not other string formatting options like .format or %)

    For example, let's say I want to display 2 digits after the decimal place.

    How do I do that? Let's say that

    a = 10.1234

    Continue reading...

Compartilhe esta Página