How to write string (float) to file?

Paul Rubin phr-n2001 at nightsong.com
Tue Aug 28 06:12:56 EDT 2001


"Piotr Legiecki" <piotrlg at sci.pam.szczecin.pl> writes:
> How can I tell python to give me only 2 digits after decimal point? And
> of course store it in a variable.
> 
> So I want 'c' to be 3.33.

print '%.2f' % c



More information about the Python-list mailing list