In Python (3), I would like to write a number to a string and keep trailing zeros to a specified precision. The trick is (and why this question is different from others I've seen on this site), the precision is to be specified at run-time based on other factors, and the precision will not necessarily be the same across all the numbers I am writing to a string.
Something like
'{0:.5f}'.format(number)
But with the 5
being a variable.
How would I go about doing this?