I am working on an assignment for my programming class (a class that I’m greatly struggling in) where I need to use the field calculator to create a python code snippet to remove the last two characters from the values in field 1. I know there are similar questions on this forum, yet I’m finding it hard to apply those suggestions to my problem. Any guidance would be very much appreciated.
Thank you in advance.
In python, strings are iterables... in the field calculator use the python parser and it would be
!YourFieldNameHere![:-2]
of course you have to calculate this value into a new field
Now you didn't specify whether it is possible that the field would contain less than 2 characters. This is a simple field calculation, so normally you would use a field calculation
and call it with
cal(!YourFieldNameHere!)