[Tutor] How to ignore some decimal values?

dman dsh8290@rit.edu
Thu, 17 Jan 2002 14:08:08 -0500


On Thu, Jan 17, 2002 at 09:41:37AM -0500, Mando Escamilla wrote:
 
| You could also use fpformat, which seems to do the same thing :-).
| 
| >>> import fpformat
| >>> a = 5.44444
| >>> i = 1
| >>> print fpformat.fix(a, i);
| 5.4
| >>>

I wasn't aware of this module, but it isn't quite the same :


>>> type( fpformat.fix( 5.4444 , 1 ) )
<type 'string'>


In that case you get back a string, not a float.

-D

-- 

THe lot is cast into the lap,
but its every decision is from the Lord.
        Proverbs 16:33