Seems to be a bug in Python. I'm not sure why it doesn't convert f to a float. I guess you'll have to convert it to a float manually.
Aaron Meurer On Fri, Nov 29, 2013 at 6:09 AM, Pierre H <[email protected]> wrote: > Hi, > > Maybe I missed it, but I didn't find an Github issue about the > implementation of new-style formatting of Float objects (I'm using sympy > 0.7.3). I ran accross it while trying to format the output of an evalf() : > > In [1]: from sympy import Float > > > In [2]: f = Float(1) > > > In [3]: f > > Out[3]: 1 > > > In [4]: '%.1f' % f > > Out[4]: '1.0' > > > In [8]: '{:f}'.format(f) > > --------------------------------------------------------------------------- > > ValueError Traceback (most recent call last) > > <ipython-input-8-4804878b7a9a> in <module>() > > ----> 1 '{:f}'.format(f) > > > ValueError: Unknown format code 'f' for object of type 'str' > > > Should I open an issue ? > > > best, > > Pierre > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/sympy. > For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sympy. For more options, visit https://groups.google.com/groups/opt_out.
