Converting a float to a formatted outside of print command

Vlastimil Brom vlastimil.brom at gmail.com
Mon Nov 23 16:28:53 EST 2009


2009/11/23 stephen_b <redplusbluemakespurple at gmail.com>:
> I'd like to convert a list of floats to formatted strings. The
> following example raises a TypeError:
>
> y = 0.5
> x = '.1f' % y
> --
> http://mail.python.org/mailman/listinfo/python-list
Maybe
'%.1f' % y
?

hth
  vbr



More information about the Python-list mailing list