Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有一种简单的方法可以在 mako 中调用给定字符串名称的函数?
您应该能够在globals(). 例如。:
globals()
<$ func_name = 'my_function_name' %> ${globals()[func_name](...)}
虽然,这对我来说确实闻起来很讨厌。如果您可以扩展您的最终游戏,也许我们可以找出一些更理智的东西。