1 00:00:00,900 --> 00:00:08,280 Hello, friends, in this video, we shall see how you can pass a variable data to the rules that you 2 00:00:08,280 --> 00:00:09,990 do find in your flask application. 3 00:00:14,160 --> 00:00:24,540 It is possible to build you are you are dynamically one instance in this Python script you have defined 4 00:00:25,410 --> 00:00:26,800 and you are Elkader Slash. 5 00:00:26,880 --> 00:00:27,190 Hello. 6 00:00:28,690 --> 00:00:36,700 And in the browser, after winning the court and after the server starts, if you say localhost 5000, 7 00:00:37,130 --> 00:00:37,480 hello? 8 00:00:38,380 --> 00:00:42,430 But in front of hello you again you slash to to your point. 9 00:00:43,480 --> 00:00:50,170 So this tutorials point stream will be picked up by the variable called last name. 10 00:00:52,710 --> 00:01:01,440 So this tutorial points will become the value of the variable called name, and then you know that as 11 00:01:01,440 --> 00:01:05,680 though you are given the associated view function starts execute executing. 12 00:01:06,060 --> 00:01:12,250 So this name will now be parsed as the key word argument to the function called Slonim. 13 00:01:13,830 --> 00:01:18,780 So the function will execute the whatever the process the function has to do, will do, and it will 14 00:01:18,780 --> 00:01:19,940 return this thing. 15 00:01:20,130 --> 00:01:22,550 Hello person to person name. 16 00:01:22,560 --> 00:01:23,400 You know what happens? 17 00:01:23,730 --> 00:01:27,610 The value of the variable name will be substitute substitute for that percentage. 18 00:01:27,630 --> 00:01:34,710 So as the effect, what will happen, the output generated on the browser will be allowed to use point. 19 00:01:36,500 --> 00:01:44,450 So, Sam, you are using the same you are you finding now, right, localhost 5000 hello, Python in 20 00:01:44,450 --> 00:01:47,780 front of it in front of a large python. 21 00:01:47,780 --> 00:01:53,390 If I write, the python will become the name of the the value of the variable name that will be given 22 00:01:53,390 --> 00:01:54,140 to the function. 23 00:01:54,320 --> 00:01:56,140 And in turn, that will print. 24 00:01:56,150 --> 00:01:56,840 Hello, Python. 25 00:01:58,070 --> 00:02:03,650 So what you are doing, you are generating the you are dynamically with the help of the variable value 26 00:02:03,650 --> 00:02:04,380 that is passed. 27 00:02:04,850 --> 00:02:06,290 So how that is done. 28 00:02:07,490 --> 00:02:10,190 First, let us do this right. 29 00:02:10,190 --> 00:02:13,040 This program starts and you are like this. 30 00:02:13,730 --> 00:02:16,560 See the value to this point is generated on the browser. 31 00:02:16,580 --> 00:02:23,480 So let us do it by running an example in front of you, the root decorator of your flask object. 32 00:02:24,570 --> 00:02:33,630 Has a facility to provide a variable information or variable data to the associated view function. 33 00:02:35,440 --> 00:02:38,710 So if I in my brother's address bar. 34 00:02:40,480 --> 00:02:48,790 You know, gewgaw hello, everybody, let us see so that additional part of the you are ill, everybody 35 00:02:48,790 --> 00:02:56,380 will be stored in the variable called name and that this name, the name of the variable is to be put 36 00:02:56,380 --> 00:03:00,130 inside the left and right, angular brackets. 37 00:03:01,620 --> 00:03:09,240 So now, as if this variable is Bastad to the keyword argument, Calder's name in our regular python 38 00:03:09,240 --> 00:03:09,720 function. 39 00:03:10,960 --> 00:03:12,670 So what will happen the. 40 00:03:14,260 --> 00:03:23,400 Dear to everybody that I had mentioned in my You Are Ill will be picked up by this provision, name 41 00:03:24,040 --> 00:03:27,130 the variable name that I have put into the left and right. 42 00:03:27,130 --> 00:03:28,990 Curly brackets will now become the. 43 00:03:30,080 --> 00:03:31,570 Value of this parameter name. 44 00:03:31,890 --> 00:03:37,620 Now I can use it and generate this output on the browser window. 45 00:03:39,010 --> 00:03:46,940 So different types of variable data can be passed to this view function, like, for example, by default, 46 00:03:46,940 --> 00:03:49,360 the variable data that can be passed is a string. 47 00:03:49,520 --> 00:03:54,340 You can also pass an integer on the floor, etc. in this example. 48 00:03:55,900 --> 00:04:03,470 We are seeing how a string data can be passed as a variable to the associated view functions. 49 00:04:03,940 --> 00:04:14,980 So let us see, open the browser and pass some variable string to that particular view function so the 50 00:04:14,980 --> 00:04:15,820 server is running. 51 00:04:17,050 --> 00:04:23,680 I mention the you are all containing a variable part, so if I say. 52 00:04:25,540 --> 00:04:26,290 Like this. 53 00:04:28,510 --> 00:04:30,430 What happens this? 54 00:04:31,350 --> 00:04:38,880 Part will be taken up by the variable name that I have put into inside the left and right angle brackets, 55 00:04:38,880 --> 00:04:45,610 and then that in turn will be passed on to the function hello as a keyword arguments. 56 00:04:45,610 --> 00:04:46,940 So let us see what happens. 57 00:04:49,610 --> 00:04:50,190 There you go. 58 00:04:50,570 --> 00:04:51,080 This. 59 00:04:52,290 --> 00:04:59,160 Is picked up as the string variable and parts to the variable in will function.