Templates concept in PYTHON
What is Template ?
Template is a class of String module.
It allows for data to change without having to edit the application. It can be modified with subclasses. Templates provide simpler string substitutions . Templates substitution is “$“-based substitutions
How do I use a template in Python?
To use the Python Template class in our code, we need to:
How it works ?
example program in python using templates
OUTPUT:
Template Errors
here we didn't provided the value for placeholder error,so we get key error
here,the placeholder price is started with number ,so we get value error
Safe_substitute()