printing limited number formt

Text(“The Ratio = rise / span = %f.” %ratioar1, “large”)

this prints several numbers like 0.33333333

is there a way to format it to print a certain number of digits and how to write it ?


You’ll need to use a format string. For example:

print "Number Format: %.3f" %(0.3333333333)

will print “0.333”

So in general you can use “” where n is the number of decimal places you want to show.

but this is good for print command

but waht bout the Text command like i;v shown ?

i tried to apply this but did not see how to make it work!


Should work the same way:

		Text("The Ratio  = rise / span = %.3f."  %(ratioar1), "large")

don’t know what i did

but now it’s working fine