I need to print a value into log file. My value is a float in range 0-1. The value needs to be formatted as 4 decimal digits, without integer part. So 0.42 will be printed as 4200, and with some text before.
This is my current approach:
value = 0.42
print('my value is ' + f'{value:.4f}'[2:])
It somehow doesn't look very nice, so the question is: can I use float formatting in a way that I could avoid concatenating two string, something like:
print(f'my value is {value:-1.4f}') # this looks nicer but doesn't do what I want