AnsweredAssumed Answered

Python Script to Automate Zip Codes Help

Question asked by maddiehaynes on Jun 20, 2017
Latest reply on Jun 20, 2017 by Dan_Patterson

So I am dealing with zip codes and when the zip code starts with 0, excel does not keep and when I import into arcmap, I therefore have issues joining to other shapefiles with a zip-code field. I am trying to write a script that will automate this process and calculate a new field to ensure that all zip codes have 5 digits but I cant get it to work. Attached is what I have written in python, essentially to determine the length of the zip code, and if it is complete (5digits) just make I a string and if it is not, to concatenate the necessary number of 0s to make it 5 digits.

Attachments

Outcomes