I have a ZCTA shapefile that I would like to join to a table by the zipcode. My problem is that some of the zip codes in the table have a 5+4 digit format, and the ZCTA shapefile has only the 5 digit format. I would like to remove the last 4 digits of the 9 digit zipcodes using field calculator. My current method was to use slicing in python, but the code will not run. This is what im currently using: I created a new field in the table ('Field9') of type text and made it equal to the zipcode field 'ZIP' and used field calculator with this code
for i in Field9:
i = i[0:4]
Why wont this compile? I am fairly new to using python on arc.