On Nov 23, 3:17 pm, Dan Bishop wrote:
> You meant:
>
> x = '%.1f' % y
Thanks, I'm a dufus today.
--
http://mail.python.org/mailman/listinfo/python-list
2009/11/23 stephen_b :
> 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
--
http://mail.python.org/mailman/listinfo/python-lis
On Nov 23, 2009, at 4:15 PM, stephen_b wrote:
I'd like to convert a list of floats to formatted strings. The
following example raises a TypeError:
y = 0.5
x = '.1f' % y
You're missing a percent sign:
x = '%.1f' % y
or:
print '%.1f' % 0.5
Hope this helps
Philip
--
http://mail.python.o
You forgot a % simbol in your string:
y = 0.5
x = '*%*.1f' % y
[]s
iurisilvio
On Mon, Nov 23, 2009 at 7:15 PM, stephen_b wrote:
> 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/mai
On Nov 23, 3:15 pm, stephen_b
wrote:
> I'd like to convert a list of floats to formatted strings. The
> following example raises a TypeError:
>
> y = 0.5
> x = '.1f' % y
You meant:
x = '%.1f' % y
--
http://mail.python.org/mailman/listinfo/python-list