Avoid trailing zeroes when formatting decimal series indices

This commit is contained in:
Kovid Goyal 2022-02-19 09:04:37 +05:30
parent 41045fc367
commit b7eb5bd5ac
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -228,7 +228,10 @@ def fmt_sidx(i, fmt='%.2f', use_roman=False):
return str(i) return str(i)
if int(i) == float(i): if int(i) == float(i):
return roman(int(i)) if use_roman else '%d'%int(i) return roman(int(i)) if use_roman else '%d'%int(i)
return fmt%i ans = fmt%i
if '.' in ans:
ans = ans.rstrip('0')
return ans
class Resource: class Resource: