Except that it doesn't work if you are trying to create a string with always 4 characters or some other fixed width. Using the format function with 1234, you get 1234. With 123, you get 0123. With 12, you get 0012. With 1, you get 0001. Your example works only for the third case where the initial string is 2 characters long. You could modify your example to test the string length first and pad with 0, 1, 2, or 3 leading zeroes in a case statement, but that's a lot more work than letting a single function do it for you.