You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi I am using Pi Pico MicroPython v1.19.1 I cannot find a way to get decimal numbers and thousand seperator looks like they are mutually exclusive.
number = 456324
print('{:,}'.format(number)) # Works
print('{:,.2f}'.format(number)) # Not working
number = 456324.56
print('{:,}'.format(number)) # Not working
print('{:,.2f}'.format(number)) # Not working
I think it's fair to say that it's considered a low priority for the core devs (it doesn't cause a crash and there are - admittedly awkward - workarounds). That said, it'd be very welcome patch!
diff --git a/tests/float/float_format.py b/tests/float/float_format.py
index 98ed0eb096..7776b6ea4f 100644
--- a/tests/float/float_format.py+++ b/tests/float/float_format.py@@ -25,3 +25,7 @@ for r in range(38):
# But formatting as 0.999...e-r is NOT ok.
if s[0] == "0":
print("FAIL:", s)
++# Test the thousands separator+for val in (0, 1, 99, 1000, 9999, 456324, 1_000_000):+ print("{:,f}".format(float(val)))
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Hi I am using Pi Pico MicroPython v1.19.1 I cannot find a way to get decimal numbers and thousand seperator looks like they are mutually exclusive.
any suggestions
All reactions