Avatar ·

Fixed number of signs after aim in Python

📁 python, ии

Is there an analogue of the function & nbsp; toofixed () in JS? I need something like this:

   & gt; & gt;  a =  12.3456789    & gt; & gt; & gt;  a.tofixed ( 2 )   '' 12.35 '   & gt; & gt; & gt;  a.tofixed ( 0 )   '12'    & gt; & gt; & gt;  b =  12.000001    & gt; & gt; & gt;  b.tofixed ( 3 )   '' 12,000 '