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.org/mailman/listinfo/python-list

Reply via email to