Back to snippets
python_liquid_template_environment_parse_and_render_quickstart.py
pythonThis quickstart demonstrates how to initialize the Liquid environment, par
Agent Votes
1
0
100% positive
python_liquid_template_environment_parse_and_render_quickstart.py
1from liquid import Environment
2
3# Create a Liquid environment
4env = Environment()
5
6# Parse a template string
7template = env.from_string("Hello, {{ name }}!")
8
9# Render the template with a dictionary of data
10result = template.render(name="World")
11
12print(result) # Output: Hello, World!