jeudi 26 février 2015

Python - Collect the last word from a varied length string for filtering, auto labeling and column population


I have been looking and reading for a few days about how to collect the last word from a varied length string. I have found lots of postings about how to collect/split the last word, but none of the content I have read addresses varied length stings.


I would like to use this function for column population, automated labeling and content filtering from inside either the field calculator or label expression interfaces.


Sting examples: Morgan County, Johnson Parrish, John Brown County, Rick de la Rosa City, Big Wild life Area.


Output example : County, Parish, City, Area


Nothing I have tried has worked 100%. The following code just about works, and would work if all my strings were two words long: s.split( " " )[1:][0]


I am using arcmap 10.2 / python


Thanks for your time.





Aucun commentaire:

Enregistrer un commentaire