I would like to create an expression using the field calculator in ArcMap to be able to convert an Int field to a string and add leading zeroes.

I am able to do it in a python window with an example

print str(x).zfill(4)

I have tried:


but that gives me invalid syntax errors.


1 Answer 1


str is a class, not a method, so you need to do:


This should work if the Time field is an integer. If it's a float or other type, you will need to recast it as an int.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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