Using python 2.7.4 and 3.3.1:
from textwrap import dedent as dd
name='Maruja'
print(dd('''
{0}:
_.-.
'( ^{_} (
`~\`-----'\\
)_)---)_)
'''.format(name)))
It´s a key error in both:
$ python3 test.py # or python2 test.py
Traceback (most recent call last):
File "test.py", line 9, in <module>
'''.format(name)))
KeyError: '_'
With the % operator it works though:
from textwrap import dedent as dd
name ='Maruja'
print(dd('''
%s:
_.-.
'( ^{_} (
`~\`-----'\\
)_)---)_)
''' % name))
No error but why?
$ python3 test2.py # or python2 test2.py
Maruja:
_.-.
'( ^{_} (
`~\`-----'\
)_)---)_)
I have not been able to figure out why this happens and I have tested in several environments, what's wrong with it?