dms8md23

Python Field Calculator Equivalent [:] of Right( ) or Left( ) in VB Field Calculator

Discussion created by dms8md23 on Jan 6, 2011
Latest reply on Jan 6, 2011 by zaloudek
I'm starting to use Python in the Field Calculator and I just found this out after an hour or so of frustration using rstrip() and rsplit() realized its even easier though not as obvious.

So lets say I wanted to remove the leading character of a 8 digit string in my [UID] field

In VB I'd say:

Right([UID], 7)

In Python I'm saying

!UID![1:]

You may put numbers after the colon [1:4] as well to manipulate the return string lengths and where the string is pulling those lengths from, other than that I don't know but it may help if someone knows the name of this function - if so please comment below?

Outcomes