Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
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
6
class
safesub(dict):
7
def
__missing__(self, key):
8
return
'{%s}'
% key
9
10
s =
'{name} has {n} messages.'
11
Callers
2
example.py
File · 0.85
sub
Function · 0.85
Calls
no outgoing calls
Tested by
no test coverage detected