Format intermittent

Hi There

I’m trying to take a number and format it to a currency like so:

self.text_box_1.text = “R{c:0.2f}”.format(c=currency)

It’s been working fine for two days. And now it isn’t - not sure if I changed anything to effect this? I’m on the same browser as always. I get the error message:

“format spec not yet implemented”

I guess I could do a server call every time I need a currency formatted but that seems a shame when the client-side seems to be able to handle it.

Thanks in advance
Bruce

HI Bruce,

What happens if you print(currency) directly beforehand, to check that its value is what you expect it to be?

1 Like

Oh my. I feel like an idiot.

Thanks it was None so obviously format wouldn’t work.

Cheers and thanks for the help

2 Likes