<jupyter_start><jupyter_text>Template  String Template Class in Python ```In String module, Template Class allows us to create simplified syntax for output specification. The format uses placeholder names formed by $ with valid Python identifiers (alphanumeric characters and underscores). Surrounding the placeholder with braces allows it to be followed by more alphanumeric letters with no intervening spaces. Writing $$ creates a single escaped $:```  Example<jupyter_code># A Simple Python templaye example 
from string import Template 
# Create a template that has placeholder for value of x 
t = Template('x is $x') 
# Substitute value of x in above template 
print (t.substitute({'x' : 1}))<jupyter_output>x is 1<jupyter_text>Example<jupyter_code>from string import Template

def Main():

    cart = []
    cart.append(dict(item='Coke', price=8, qty=2 ))
    
    t = Template('$qty x $item = $price')
    total = 0
    print('Cart:')
    
    for data in cart:
        print(t.substitute(data))
        total += data['price']
        
    print('Total: ' + str(total) )
   
    
if __name__ == '__main__':
    Main()<jupyter_output>Cart:
2 x Coke = 8
Total: 8
{'fraction_non_alphanumeric': 0.09682947729220223, 'fraction_numerical': 0.006855184233076264, 'mean_word_length': 3.8666666666666667, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '509096', 'license': 'MIT', 'n_tokens_mistral': 360, 'n_tokens_neox': 347, 'n_words': 130, 'path': 'AdvanceTopics/Template.ipynb', 'repo_name': 'cusey/PythonExamples', 'size': '1167'}