Suppose I have a number that I want to put in a string.
x = 0.13 How can I format my string so that the leading zero does not appear?
print('This is my formatted number: {formating}'.format(x)) >> This is my formatted number: .13 You can use the strip method:
x = 0.13 res = str(x).strip('0') print('This is my formatted number: {}'.format(res)) round function: res = str(round(x, 2)).strip('0')