Interpolating Variables Inside Strings : Template : String PYTHON TUTORIALS


PYTHON TUTORIALS » String » Template »

 

Interpolating Variables Inside Strings


import string

values = [53'blue', 'red']
s = string.Template("Variable v = $v")

for x in values:
    print s.substitute(v=x)



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo String
» Template