Instead of 007, I wish to print 117, using string formatting.
But instead, it adds 12 empty characters before the 7. Tried using a variable too, in place of the 1. No luck. Please help.
Code:
num=7 print(f'{num:03d}') print(f'{num:13d}') val=1 print(f'{num:{val}3d}')
.rjust(3, '1')