Tuesday, 8 May 2018

Deleting first two letters from string field usimng Python Parser of ArcGIS Field Calculator?


I'm looking for a field calculator Python statement to delete only the first two letters of string entries. For Ex:


!Name!.strip([0:2])

I know this syntax is incorrect.



Answer



You slice the string to be the third character through the end of the string (strings are zero indexed).


!Name![2:]

No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...