什么是(Mel)替换的Python等价物,Maya

什么是(Mel)替换的Python等价物,Maya,python,maya,substitution,mel,Python,Maya,Substitution,Mel,我正在寻找一个Python的替代品,任何建议都将不胜感激。 谢谢 : 虽然显然可以用Python编写一个等价的库,但是已经提供的高级库是可以使用的(在这种情况下,它的性能肯定会更好) 看起来像str.replace(),或者XrigNamespace是正则表达式吗?如果不使用正则表达式,则它的str.replace()不可用 for j in Xjoints: j = substitute( XrigNamespace, j, '') import re test = "Hello -

我正在寻找一个Python的替代品,任何建议都将不胜感激。 谢谢


虽然显然可以用Python编写一个等价的库,但是已经提供的高级库是可以使用的(在这种情况下,它的性能肯定会更好)

看起来像
str.replace()
,或者
XrigNamespace
是正则表达式吗?如果不使用正则表达式,则它的str.replace()不可用
for j in Xjoints:
    j = substitute( XrigNamespace, j, '')
import re
test = "Hello -%there%-"
regularExpr = "-%.*%-"
s1 = re.sub(regularExpr, "Mel", test)
# Result: Hello Mel
s2 = re.sub("foo", "Mel", test)
# Result: Hello -%there%-