string.Formatter doesn't support empty curly braces "{}" unlike str.format .
>>> import string
>>> a = string.Formatter()
>>> a.format("{}","test")
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
a.format("{}","hello")
File "/usr/lib/python3.2/string.py", line 180, in format
return self.vformat(format_string, args, kwargs)
File "/usr/lib/python3.2/string.py", line 184, in vformat
result = self._vformat(format_string, args, kwargs, used_args, 2)
File "/usr/lib/python3.2/string.py", line 206, in _vformat
obj, arg_used = self.get_field(field_name, args, kwargs)
File "/usr/lib/python3.2/string.py", line 267, in get_field
obj = self.get_value(first, args, kwargs)
File "/usr/lib/python3.2/string.py", line 226, in get_value
return kwargs[key]
KeyError: '' |