The problem is that those {
and }
characters you have there don’t specify a key for formatting. You need to double them up, so change your code to:
addr_list_formatted.append("""
"{0}"
{{
"gamedir" "str"
"address" "{1}"
}}
""".format(addr_list_idx, addr))
More Related Contents:
- Format string unused named arguments [duplicate]
- How to get Python to gracefully format None and non-existing fields [duplicate]
- Leaving values blank if not passed in str.format
- How to use % symbol correctly
- How can I fill out a Python string with spaces?
- Python’s many ways of string formatting — are the older ones (going to be) deprecated?
- How can I format a decimal to always show 2 decimal places?
- What does a b prefix before a python string mean?
- What does preceding a string literal with “r” mean? [duplicate]
- Putting an if-elif-else statement on one line?
- Why are trailing commas allowed in a list?
- When are parentheses required around a tuple?
- Which is more preferable to use: lambda functions or nested functions (‘def’)?
- Python Script returns unintended “None” after execution of a function [duplicate]
- Convert commas decimal separators to dots within a Dataframe
- What does [:] mean?
- Meaning of using commas and underscores with Python assignment operator? [duplicate]
- Is there a difference between continue and pass in a for loop in Python?
- How do you express binary literals in Python?
- Logging variable data with new format string
- Recursively access dict via attributes as well as index access?
- Python print statement “Syntax Error: invalid syntax” [duplicate]
- The difference between double brace `[[…]]` and single brace `[..]` indexing in Pandas
- What does ** (double star/asterisk) and * (star/asterisk) do for parameters in Python?
- How to implement conditional string formatting?
- What do ** (double star/asterisk) and * (star/asterisk) mean in a function call?
- Can Python’s logging format be modified depending on the message log level?
- What does the ** maths operator do in Python?
- Why does newList = list.remove(x) return None? [duplicate]
- Python [Invalid syntax] with async def