Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/dabeaz/python-cookbook
/ sub
Function
sub
src/2/variable_interpolation_in_strings/example.py:25–26 ·
view source on GitHub ↗
(text)
Source
from the content-addressed store, hash-verified
23
n = 37
24
import
sys
25
def
sub(text):
26
return
text.format_map(safesub(sys._getframe(1).f_locals))
27
28
print(sub(
'Hello {name}'
))
29
print(sub(
'{name} has {n} messages'
))
Callers
1
example.py
File · 0.70
Calls
1
safesub
Class · 0.85
Tested by
no test coverage detected