https://stackoverflow.com/questions/3404245/string-formatting-django
A better, more modern approach might be that of https://www.w3schools.com/python/ref_string_format.asp
txt = "For only {price:.2f} dollars!"
print(txt.format(price = 49))
or better yet:
txt1 = "My name is {fname}, I'm {age}".format(fname = "John", age = 36)
txt2 = "My name is {0}, I'm {1}".format("John",36)
txt3 = "My name is {}, I'm {}".format("John",36)
No comments:
Post a Comment