How to write string (float) to file?
grante at visi.com
Wed Aug 29 18:16:17 CEST 2001
In article <bo8j7.54122$c8.24122471 at news1.denver1.co.home.com>, Rainer Deyke wrote:
> "Grant Edwards" <grante at visi.com> wrote in message
> news:slrn9ops86.ks3.grante at grante.comtrol.com...
>> In article <9ZOi7.53225$c8.23251519 at news1.denver1.co.home.com>, Rainer
> Deyke wrote:
>> ><gbreed at cix.compulink.co.uk> wrote in message
>> > news:9mfqmi$ko4$1 at thorium.cix.co.uk...
>> >> c = '%.2f'%(float(a)/b)
>> > That's unreliable. Use this instead:
>> After reading a handful of follow-ups, I'm still curious what
>> you mean when you say that's unreliable.
>>>> def foo(a, b): return '%.2f' % (float(a)/b)
>>>> foo(1, 200)
>>>> foo(3, 200)
>>>> foo(5, 200)
>>>> foo(10000000000000000000000000000000000000000l, 2)
Thanks, but that wasn't helpful. Am I to assume that you're
not happy with one of the results? Which one? Why do you
think it's wrong?
Grant Edwards grante Yow! I've read SEVEN
at MILLION books!!
More information about the Python-list