0

I can't figure out why the following string is broken:

print '{% extends \"{base_route_name}.html\" %}'.format(base_route_name='base')

It returns the following error:

KeyError: '% extends "{base_route_name}'

I've tried using double %% as suggested in answers to this question and other escaping measures to no avail.

The only way I was able to fix it was to do this:

print '{% extends \"' + base_route_name + '.html\" %}'

Any ideas why using format() wasn't working?

Community
  • 1
  • 1
Blairg23
  • 11,334
  • 6
  • 72
  • 72

0 Answers0