type float problem

Pavol Juhas pavol.juhas at gmail.com
Thu Mar 26 14:41:09 EDT 2009


This has nothing to do with numpy, the issue is the string "%"
operator
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]

Works:
    print "%f" % 1
    print "%f" % (1, )
    print "%f" % tuple([1])
    print "%f" % a[0]

Hope this helps,

Pavol



More information about the Python-list mailing list