String formatting: string specifier in a string constant
Posted
by hyn
on Stack Overflow
See other posts from Stack Overflow
or by hyn
Published on 2010-03-31T07:48:56Z
Indexed on
2010/03/31
7:53 UTC
Read the original article
Hit count: 478
python
Is there a way to insert a string in a string constant/variable that contains a string specifier?
Example:
temp_body = 'Hello %s, please visit %s to confirm your registration.'
body = temp_body % (name, url)
But this raises a TypeError.
© Stack Overflow or respective owner