I'm a beginning Python user.
Using ArcGIS Pro 2.9.2, I'd like to use python code in the field calculator to generate unique IDs based on the Object ID field. The unique ID should be 3 letters followed by a dash, followed by five digits. It should be a string. For example:
Object ID 1 should generate 'Bcn-00001'
Object ID 10 should generate 'Bcn-00010'
I was thinking something like:
FacID = .str('Bcn-000+!OBJECTID!')
I don't know how to make the number of zeros in front of the Object ID vary based on the number of digits in the Object ID
Thanks!
Solved! Go to Solution.
"Bcn-{0:0>5}".format(1)
'Bcn-00001'
"Bcn-{0:0>5}".format(100)
'Bcn-00100'
plus other variants
"Bcn-{0:0>5}".format(1)
'Bcn-00001'
"Bcn-{0:0>5}".format(100)
'Bcn-00100'
plus other variants
Thanks!