AFAIU, string.Template doesn't help. This seems to be helpful:
import re def interp(string, params): for item in re.findall(r'#\{([^}]*)\}', string): string = string.replace('#{%s}' % item, str(eval(item, {}, params))) return string Evgeniy, do you know some better options for this? Aleksey Kasatkin On Tue, Jul 28, 2015 at 1:12 PM, Sergey Vasilenko <svasile...@mirantis.com> wrote: > If we need only substitution, probably it's better to use standard >> templating >> in python [1], there is a way to redefine tokens, so you will be able to >> use >> <% %> syntax if you want to. >> >> [1] https://docs.python.org/2.6/library/string.html#template-strings >> <https://docs.python.org/dev/library/string.html#template-strings> >> [2] http://pymotw.com/2/string/#advanced-templates >> > > I think it's a better solution for this issue. > > /sv > > __________________________________________________________________________ > OpenStack Development Mailing List (not for usage questions) > Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe > http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev > >
__________________________________________________________________________ OpenStack Development Mailing List (not for usage questions) Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev