for j in Xjoints:
j = substitute( XrigNamespace, j, '')
I'm looking to write a Python equivalent for Substitute, any suggestions would be greatly appreciated. Thanks!
for j in Xjoints:
j = substitute( XrigNamespace, j, '')
I'm looking to write a Python equivalent for Substitute, any suggestions would be greatly appreciated. Thanks!
Regular expression substitution:
import re
test = "Hello -%there%-"
regularExpr = "-%.*%-"
s1 = re.sub(regularExpr, "Mel", test)
# Result: Hello Mel
s2 = re.sub("foo", "Mel", test)
# Result: Hello -%there%-
While it's obviously possible to write an equivalent in Python, the high level libraries already provided are there to be used (and will in this case certainly perform better).