How can i convert a field 1,2,3,4... to 001,002,003,004...010...?

For example

1 change to 001
2 change to 002 
3 change to 003


Is there any formula in field calculator?

enter image description here


Use Field Calculator with Python parser and the zfill method:

Pad a numeric string s on the left with zero digits until the given width is reached

Pre-logic script code:

def pad(code):
    return str(code).zfill(3)

And call with:

pad( !Code!)

enter image description here


Another solution in Field Calculator with Python parser could be achieved with the use of zero padding and width flags

def oldblock(code):
    return "%03d" % code

Not the answer you're looking for? Browse other questions tagged or ask your own question.