type float problem
rolandschulzhd at googlemail.com
Fri Mar 27 01:27:12 CET 2009
On Mar 26, 2:41 pm, Pavol Juhas <pavol.ju... at gmail.com> wrote:
> This has nothing to do with numpy, the issue is the string "%"
> cannot convert list to a float (Line 3 in your example gives a list).
> In '"%f" % x' the x has to be a number or tuple.
> Does not work:
> print "%f" % [1.0]
Yes that helps. Why is it that the %-operator requires a tuple and
does not work with a list?
Thus why doesn't this work: "%d %d"%[2,2]
but instead it has to be: "%d %d"%tuple([2,2])
or: "%d %d"%(2,2)
More information about the Python-list