Hello, friends, in this video, we shall see how you can pass a variable data to the rules that you
do find in your flask application.
It is possible to build you are you are dynamically one instance in this Python script you have defined
and you are Elkader Slash.
Hello.
And in the browser, after winning the court and after the server starts, if you say localhost 5000,
hello?
But in front of hello you again you slash to to your point.
So this tutorials point stream will be picked up by the variable called last name.
So this tutorial points will become the value of the variable called name, and then you know that as
though you are given the associated view function starts execute executing.
So this name will now be parsed as the key word argument to the function called Slonim.
So the function will execute the whatever the process the function has to do, will do, and it will
return this thing.
Hello person to person name.
You know what happens?
The value of the variable name will be substitute substitute for that percentage.
So as the effect, what will happen, the output generated on the browser will be allowed to use point.
So, Sam, you are using the same you are you finding now, right, localhost 5000 hello, Python in
front of it in front of a large python.
If I write, the python will become the name of the the value of the variable name that will be given
to the function.
And in turn, that will print.
Hello, Python.
So what you are doing, you are generating the you are dynamically with the help of the variable value
that is passed.
So how that is done.
First, let us do this right.
This program starts and you are like this.
See the value to this point is generated on the browser.
So let us do it by running an example in front of you, the root decorator of your flask object.
Has a facility to provide a variable information or variable data to the associated view function.
So if I in my brother's address bar.
You know, gewgaw hello, everybody, let us see so that additional part of the you are ill, everybody
will be stored in the variable called name and that this name, the name of the variable is to be put
inside the left and right, angular brackets.
So now, as if this variable is Bastad to the keyword argument, Calder's name in our regular python
function.
So what will happen the.
Dear to everybody that I had mentioned in my You Are Ill will be picked up by this provision, name
the variable name that I have put into the left and right.
Curly brackets will now become the.
Value of this parameter name.
Now I can use it and generate this output on the browser window.
So different types of variable data can be passed to this view function, like, for example, by default,
the variable data that can be passed is a string.
You can also pass an integer on the floor, etc. in this example.
We are seeing how a string data can be passed as a variable to the associated view functions.
So let us see, open the browser and pass some variable string to that particular view function so the
server is running.
I mention the you are all containing a variable part, so if I say.
Like this.
What happens this?
Part will be taken up by the variable name that I have put into inside the left and right angle brackets,
and then that in turn will be passed on to the function hello as a keyword arguments.
So let us see what happens.
There you go.
This.
Is picked up as the string variable and parts to the variable in will function.