I am trying to implement left padding of variable length of a string with desired fill parameter with the simplest logic if possible, even a pre-built function. e.g: 123 as dd123 where d is the fill parameter.[" " in this case]
As I found out from some sources this can be done via zfill.But it pads the string with left zeros.. But I want space padded string.
Again space" " padding can be done via '{:>10}'.format('test')-Still it is eligible only when the fill amount is hardcoded integer -as '{:>x}'.format('test') didn't work where x is the variable predefined with an integer value..
So where is the combined solution of those 2 problems?
Thanks for your time.