As an example, I have the following numbers assigned to different variables:
a = 1.23981321; b = 34; c = 9.567123
Before I print these variables, I format them to 4 decimal places:
'{:.4f} - {:.4f} - {:.4f}'.format(a, b, c)
Which prints the following:
'1.2398 - 34.0000 - 9.5671'
Instead of assigning :.4f to each placeholder { }, is there a way to declare :.4f once to format all of the values?
np.set_printoptions(precision=4); print(np.array(my_tuple)).