I am trying to write out a code for doing a number/ version padding but as I tried to search thru the internet, I am however, only able to find a MEL example in which it works but it doesn't make sense to me (most probably I do not understand how it works)
$padding = 3;
$num = 5;
string $pad = `python ("'%0"+$padding+"d' % "+$num)`;
// Results is: 005
However when I tried to convert it into Python style, I got the following result:
padding = '3'
num = '5'
pad = ("%0"+padding+"d' % "+num)
Result is: %03d' % 5
Or even as I tried to rearrange the code around, the results is either wrong (totally wrong, as you can see) or Maya errors like TypeError: cannot concatenate 'str' and 'int' objects
Any pointers?