A template for a python function

Issue

This Content is from Stack Overflow. Question asked by Rishab Gupta

Is it possible to create a python function based on user inputs using a template (using jinja or any other templating engine)?

user will pass the function name:

example

def { function_name }(params):
    print("Hello_World")

For now, I just need the function name from the user and have a function defined using it. The functionality is pre-defined.



Solution

Check the Answers

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?