[Tutor] Rounding Floating Points

alan.gauld@bt.com alan.gauld@bt.com
Tue, 1 Feb 2000 17:30:30 -0000


> $output_label2_var = sprintf("%.2f", $output_label2_var);
> 
> but have yet to find any reference to sprintf() in any my Python

Look at "format strings"

The equivalent to your sprointf is:

"%.2f" % output_label2_var

If there are multiple substitutuons you put them in a tuple...

Alan G.