ValueError: unsupported format character '}' when use % string formatting
<p>I'm trying to generate some LaTeX markup by using Python % string formatting.  I use named fields in the string and use a dictionary with matching keys for the data.  However, I get the error <code>ValueError: unsupported format character '}'</code>.  Why isn't this code working?</p>

<pre><code>LaTeXentry = '''\\subsection{{%(title)}}
    \\begin{{itemize}}
    \\item 
    %(date)
    \\item
    %(description)
    \\item
    Source:\\cite{{%(title)}}
    \\item
    filename(s):
    %(filename)
    \\item 
    Contributed by %(name)'''

LaTeXcodeToAdd = LaTeXentry % {
    "time" : Timestamp,
    "date" : date,
    "description" : summary, 
    "filename" : filename,
    "name" : name,
    "title": title,
}
</code></pre>



<pre><code>Traceback (most recent call last):
  File "file_directory", line 115, in &lt;module&gt;
    "title": title,
ValueError: unsupported format character '}' (0x7d) at index 21
</code></pre>

<p>You have to add <code>s</code> like in standard formating <code>%s</code> - so you need <code>%(title)s</code>, <code>%(date)s</code>, etc.</p>

python string-formatting