MCPcopy Create free account
hub / github.com/dabeaz/python-cookbook / safesub

Class safesub

src/2/variable_interpolation_in_strings/example.py:6–8  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4
5# Class for performing safe substitutions
6class safesub(dict):
7 def __missing__(self, key):
8 return '{%s}' % key
9
10s = '{name} has {n} messages.'
11

Callers 2

example.pyFile · 0.85
subFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected