A format string with :
and /
present. When tried formatting with a value dict
it's throwing:
ValueError: Missing ']' in format string
Example:
In [312]: value
Out[312]: {'key:/key_part': 1}
In [313]: string_to_format
Out[313]: '{v[key:/key_part]}'
In [314]: string_to_format.format(v=SafeDict(value))
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-314-3ee97d9dfb86> in <module>()
----> 1 string_to_format.format(v=SafeDict(value))
ValueError: Missing ']' in format string
where SafeDict
is the implementation used from this SO answer.
In [311]: class SafeDict(dict):
...: def __missing__(self, key):
...: return "NULL"
Any ideas on how to get through this?