A string contains a } that doesn't close an interpolation. Because { and } mark
interpolations, a literal brace must be doubled.
Wrong#
fn close(): str = "a } b"Fixed#
fn close(): str = "a }} b"Common causes#
- JSON or code text inside a string: double every brace (
{{and}}). - An extra
}after an interpolation:"{x}}". - For text full of braces, a raw string
r"..."doesn't interpolate at all.