Select to view content in your preferred language

rstrip ... Remove all characters after the comma ","

4869
1
09-28-2011 02:27 PM
JMcNeil
Deactivated User
I'm trying to strip all characters to the right of the comma from a field named Details_Primary_Address.  For some reason this doesn't work

!Details_Primary_Address1!.rstrip(",")

either does this

!Details_Primary_Address1!.rstrip(',')


I can just remove the comma like this

!Details_Primary_Address1!.replace(",", "")

but I want to also remove everthing after it (to the right).


Thanks in advance for the insight.

J
Tags (2)
0 Kudos
1 Reply
JakeSkinner
Esri Esteemed Contributor
Hi J,

You can do this using the '.rsplit' method.  Ex:

!Details_Primary_Address1!.rsplit(',', 1)[0]
0 Kudos