col1 = "test xyz" col2 = "xyz" print "<%s>\n" % col1.replace(col2,"").strip()
import re col1 = "test xyz" col2 = "xyz" pattern = re.compile(" ?xyz$") repl = "" result = re.sub(pattern,repl,col1) print "<%s> <%s> <%s>\n" % (col1,col2,result) <test xyz> <xyz> <test>
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.