1
00:00:00,000 --> 00:00:00,000
Hello guys.

2
00:00:00,000 --> 00:00:02,000
So we are going to continue our discussion with respect to Python.

3
00:00:02,000 --> 00:00:06,000
And in this video we are going to discuss about standard library overview.

4
00:00:06,000 --> 00:00:12,000
Now Python has a lot and lot of libraries and packages which are completely open source.

5
00:00:12,000 --> 00:00:16,000
And you can definitely use them while you're coding your projects or developing something.

6
00:00:16,000 --> 00:00:17,000
Right?

7
00:00:17,000 --> 00:00:20,000
So in this video I'll be showing you some set of libraries.

8
00:00:20,000 --> 00:00:25,000
Obviously, it is not possible to cover all the libraries because they are more than, you know, 300

9
00:00:25,000 --> 00:00:27,000
K plus libraries, I guess.

10
00:00:27,000 --> 00:00:30,000
Uh, so it is very much difficult to cover each and every thing.

11
00:00:30,000 --> 00:00:34,000
But just to give you an idea how to use some of the libraries, I'll be talking about them.

12
00:00:34,000 --> 00:00:36,000
So first of all I'm going to show you about array.

13
00:00:36,000 --> 00:00:41,000
So array uh, is one important library which will actually help you to create an array itself.

14
00:00:41,000 --> 00:00:41,000
Right.

15
00:00:41,000 --> 00:00:44,000
So here if I go ahead and define my array variable.

16
00:00:44,000 --> 00:00:47,000
And if I just go ahead and write array dot array.

17
00:00:47,000 --> 00:00:47,000
Right.

18
00:00:47,000 --> 00:00:53,000
And here uh in this particular array array we have to give two parameters Okay.

19
00:00:53,000 --> 00:00:55,000
One is the temporary variable.

20
00:00:55,000 --> 00:00:56,000
Uh, let's say I'm giving I.

21
00:00:56,000 --> 00:01:00,000
And then if I give one comma, two comma three comma four.

22
00:01:00,000 --> 00:01:03,000
So here you'll be able to see type code.

23
00:01:03,000 --> 00:01:05,000
Uh sorry I basically means integer type code.

24
00:01:05,000 --> 00:01:06,000
And your initializer.

25
00:01:06,000 --> 00:01:07,000
Right.

26
00:01:07,000 --> 00:01:11,000
So with respect to that it returns a new array whose items are restricted by type code okay.

27
00:01:11,000 --> 00:01:16,000
So here it is basically going to print an array with this integers okay.

28
00:01:16,000 --> 00:01:20,000
So you can see over here that I'm able to get this particular answer right.

29
00:01:20,000 --> 00:01:23,000
So this is one uh I've already spoken about math.

30
00:01:23,000 --> 00:01:26,000
So let me just go ahead and again show you with respect to math.

31
00:01:26,000 --> 00:01:33,000
So here I'm going to use math dot skew RT1 common function that you have over here.

32
00:01:33,000 --> 00:01:38,000
So if I go ahead and want to find out the square root of any number I will be able to find it out.

33
00:01:38,000 --> 00:01:40,000
Then let me just go ahead and print.

34
00:01:41,000 --> 00:01:41,000
Okay.

35
00:01:41,000 --> 00:01:43,000
Math dot pi.

36
00:01:43,000 --> 00:01:47,000
And here you'll be able to see that I'll be able to get an answer.

37
00:01:47,000 --> 00:01:47,000
Okay.

38
00:01:47,000 --> 00:01:47,000
Perfect.

39
00:01:47,000 --> 00:01:52,000
Now let me just talk about one more inbuilt, uh, library that we have, which is called as random.

40
00:01:52,000 --> 00:01:55,000
And this is most commonly we use we use it okay.

41
00:01:55,000 --> 00:02:01,000
So all we have to do is that go ahead and just do import random okay.

42
00:02:01,000 --> 00:02:08,000
And then we will go ahead and print over here random We specifically use two important uh inbuilt function.

43
00:02:08,000 --> 00:02:12,000
So let's see which all inbuilt function is there which is called as Randint okay.

44
00:02:12,000 --> 00:02:18,000
Randint basically means it provides a any random integer based on the value that we give over here.

45
00:02:18,000 --> 00:02:19,000
Like let's say if I give one comma ten.

46
00:02:19,000 --> 00:02:24,000
So it is going to give a random integer between one to 1 to 10, only one single number it is going

47
00:02:24,000 --> 00:02:25,000
to give you.

48
00:02:26,000 --> 00:02:26,000
Right.

49
00:02:26,000 --> 00:02:28,000
Uh, you know, it will be between 1 to 10.

50
00:02:28,000 --> 00:02:32,000
It will just pick up randomly and it will be giving you a number.

51
00:02:32,000 --> 00:02:32,000
Right.

52
00:02:32,000 --> 00:02:38,000
And in one more function that we specifically use in random, which is called as random dot choice,

53
00:02:38,000 --> 00:02:41,000
let's say if I have multiple choice over here.

54
00:02:41,000 --> 00:02:45,000
And from that I want to select any choice in the case of string or anything as such.

55
00:02:45,000 --> 00:02:46,000
In in the case of collection.

56
00:02:46,000 --> 00:02:49,000
Sorry, then uh, I will be able to use this.

57
00:02:49,000 --> 00:02:51,000
So let's say apple is there, banana is there.

58
00:02:51,000 --> 00:02:55,000
And over here you'll be able to see that cherry is there.

59
00:02:55,000 --> 00:02:56,000
Okay.

60
00:02:56,000 --> 00:02:58,000
So if I go ahead and execute it.

61
00:02:58,000 --> 00:03:04,000
So here you'll be able to see that okay Randint I'm able to get one value in and the value will be between

62
00:03:04,000 --> 00:03:05,000
1 to 10 okay.

63
00:03:05,000 --> 00:03:09,000
Random choice is nothing but from the collection what choice it is basically picking up.

64
00:03:09,000 --> 00:03:09,000
Okay.

65
00:03:09,000 --> 00:03:12,000
So if I again execute it this may change.

66
00:03:12,000 --> 00:03:12,000
Okay.

67
00:03:12,000 --> 00:03:15,000
If I again execute it it this may change right?

68
00:03:15,000 --> 00:03:17,000
It may not be all the time same you know.

69
00:03:17,000 --> 00:03:20,000
So it is randomly picking up this particular values.

70
00:03:20,000 --> 00:03:25,000
Now, uh, we are going to talk about one very common library that we use that is called as OS.

71
00:03:25,000 --> 00:03:25,000
Right.

72
00:03:25,000 --> 00:03:29,000
So that is used for file and directory access.

73
00:03:29,000 --> 00:03:30,000
Okay.

74
00:03:30,000 --> 00:03:32,000
Directory access.

75
00:03:32,000 --> 00:03:35,000
We'll be talking about file handling and more operation there.

76
00:03:35,000 --> 00:03:36,000
Also we'll be using this.

77
00:03:36,000 --> 00:03:37,000
So let me just go ahead and import it.

78
00:03:37,000 --> 00:03:39,000
So this is called as import OS.

79
00:03:39,000 --> 00:03:46,000
And let's say I want to go ahead and print in which current working directory I'm working in my project.

80
00:03:46,000 --> 00:03:52,000
So I can use uh OS dot get cw d get current working directory.

81
00:03:52,000 --> 00:03:52,000
Okay.

82
00:03:52,000 --> 00:03:57,000
And if I get an execute it here, you can see that I am in this particular folder location that is my

83
00:03:57,000 --> 00:03:58,000
Udemy final Python.

84
00:03:58,000 --> 00:04:00,000
And this is my fifth module right.

85
00:04:00,000 --> 00:04:02,000
So I'm inside my fifth module.

86
00:04:02,000 --> 00:04:05,000
And automatically I'll be able to see that which working location I'm there.

87
00:04:05,000 --> 00:04:09,000
Let's say in this particular working location, I want to probably go ahead and create a folder.

88
00:04:09,000 --> 00:04:13,000
So I will go ahead and write OS dot make directory right.

89
00:04:13,000 --> 00:04:17,000
So they are make directory, make directories different different function is there.

90
00:04:17,000 --> 00:04:20,000
Let's say I want to go ahead and write test dir.

91
00:04:20,000 --> 00:04:22,000
So this will be the directory name as soon as I execute it.

92
00:04:22,000 --> 00:04:27,000
Now you'll be able to see that I will be having a folder which will be of text directory.

93
00:04:27,000 --> 00:04:28,000
Okay.

94
00:04:28,000 --> 00:04:32,000
Now one assignment that I really want to give, go ahead and find out the function that is used to create

95
00:04:32,000 --> 00:04:33,000
any file okay.

96
00:04:33,000 --> 00:04:36,000
So that you can actually go ahead and do it okay.

97
00:04:36,000 --> 00:04:42,000
Now um, let's say I want to do some high level operations on files.

98
00:04:42,000 --> 00:04:42,000
Right.

99
00:04:42,000 --> 00:04:50,000
High level operations on files and collection of files.

100
00:04:50,000 --> 00:04:51,000
Okay.

101
00:04:51,000 --> 00:04:55,000
Let's say uh, for that I will be using this import.

102
00:04:55,000 --> 00:04:58,000
Scott, shoot util.

103
00:04:58,000 --> 00:04:58,000
Okay.

104
00:04:58,000 --> 00:04:59,000
Ill.

105
00:04:59,000 --> 00:05:04,000
And this function, let's say that I want to create util over here.

106
00:05:05,000 --> 00:05:09,000
And uh, let's say that I have one source dot txt file okay.

107
00:05:09,000 --> 00:05:15,000
So here let's say I have one source dot txt file.

108
00:05:15,000 --> 00:05:17,000
And let's say here I go ahead and write.

109
00:05:17,000 --> 00:05:18,000
Hello.

110
00:05:19,000 --> 00:05:21,000
Uh, how are you?

111
00:05:22,000 --> 00:05:24,000
I'm good, I am fine.

112
00:05:25,000 --> 00:05:28,000
Welcome to the course.

113
00:05:28,000 --> 00:05:28,000
Okay.

114
00:05:28,000 --> 00:05:29,000
Something like this.

115
00:05:30,000 --> 00:05:32,000
Now inside the standard library.

116
00:05:32,000 --> 00:05:36,000
By using this, let's say I will go ahead and do one operation which is called as copy file.

117
00:05:36,000 --> 00:05:37,000
Okay.

118
00:05:37,000 --> 00:05:39,000
I will copy this file.

119
00:05:39,000 --> 00:05:41,000
That is nothing but source dot txt.

120
00:05:41,000 --> 00:05:42,000
Please make sure that you have.

121
00:05:42,000 --> 00:05:43,000
You are in the same working location.

122
00:05:43,000 --> 00:05:50,000
And then let's say I will go ahead and create my another file which is called as destination dot txt.

123
00:05:51,000 --> 00:05:54,000
Now let's see whether we'll get an error saying that whether there is a file or not.

124
00:05:54,000 --> 00:05:57,000
So here you can see destination dot txt is there.

125
00:05:57,000 --> 00:05:58,000
Did I get it?

126
00:05:58,000 --> 00:06:01,000
Yes, this is my destination dot txt.

127
00:06:01,000 --> 00:06:02,000
This is my source dot.

128
00:06:02,000 --> 00:06:07,000
TXT automatically the copy from source dot txt happened in the destination dot txt.

129
00:06:07,000 --> 00:06:13,000
Okay, so this is one another important operation that we specifically use in this.

130
00:06:13,000 --> 00:06:15,000
Okay, so let me just close this.

131
00:06:15,000 --> 00:06:17,000
I think many many files has got opened okay.

132
00:06:17,000 --> 00:06:19,000
But I hope you are able to understand it.

133
00:06:19,000 --> 00:06:21,000
What we are trying to talk about okay.

134
00:06:21,000 --> 00:06:28,000
Now the next thing is that, uh, let's talk about one very important, uh, or common property or common

135
00:06:28,000 --> 00:06:29,000
thing that we will be doing.

136
00:06:29,000 --> 00:06:34,000
It is nothing but data realization, like converting a dictionary into a JSON right, or converting

137
00:06:34,000 --> 00:06:36,000
any a data frame data frame, what it is.

138
00:06:36,000 --> 00:06:38,000
We will discuss more about it.

139
00:06:38,000 --> 00:06:41,000
Let's say that we want to convert that into a JSON.

140
00:06:41,000 --> 00:06:46,000
JSON is very much important because whenever we create an API's, let's say whenever we are retrieving

141
00:06:46,000 --> 00:06:51,000
any data from the databases, specifically NoSQL database, the return type of the data or the response,

142
00:06:51,000 --> 00:06:55,000
or we are interacting with any API, the response will be in the form of API itself, right?

143
00:06:55,000 --> 00:06:56,000
Uh, sorry.

144
00:06:56,000 --> 00:06:58,000
Response will be in the form of JSON.

145
00:06:58,000 --> 00:06:59,000
Right?

146
00:06:59,000 --> 00:07:04,000
So in order to work with JSON so we usually import this JSON uh library.

147
00:07:04,000 --> 00:07:06,000
And let's say that I am creating one data okay.

148
00:07:06,000 --> 00:07:12,000
Let's say the name is name colon is Krish okay.

149
00:07:12,000 --> 00:07:18,000
And here what we are going to do is that we are going to basically write the age will be colon equal

150
00:07:18,000 --> 00:07:19,000
to 25, right?

151
00:07:20,000 --> 00:07:22,000
So right now this is just my dictionary.

152
00:07:22,000 --> 00:07:24,000
Now if I want to convert this dictionary into JSON.

153
00:07:24,000 --> 00:07:28,000
So I will use this JSON dot dumps okay.

154
00:07:28,000 --> 00:07:36,000
And when I write JSON or dump on this particular data I will be getting JSON in the form of string okay.

155
00:07:37,000 --> 00:07:38,000
Which is basically required.

156
00:07:38,000 --> 00:07:39,000
Okay.

157
00:07:39,000 --> 00:07:41,000
Now let me just go ahead and print this okay.

158
00:07:41,000 --> 00:07:45,000
So I will go ahead and print JSON underscore str okay.

159
00:07:46,000 --> 00:07:51,000
Now once we print it and let me just go ahead and print the type of this also so that you will not get

160
00:07:51,000 --> 00:07:51,000
any confusion.

161
00:07:51,000 --> 00:07:56,000
So type of JSON underscore str okay.

162
00:07:56,000 --> 00:08:02,000
Now let's say I want to convert this back into this kind of dictionary again.

163
00:08:02,000 --> 00:08:03,000
Right.

164
00:08:03,000 --> 00:08:09,000
So for that one operation that I used is JSON dump, one operation will be JSON dot load load.

165
00:08:09,000 --> 00:08:09,000
Right.

166
00:08:09,000 --> 00:08:15,000
So whatever JSON let's say with when I'm interacting with an API, I get kind some kind of JSON in response

167
00:08:15,000 --> 00:08:20,000
that me that will be always in the string format, which I've actually converted.

168
00:08:20,000 --> 00:08:25,000
Now, if I want to convert this back into a dictionary and probably do any kind of operation over here

169
00:08:25,000 --> 00:08:30,000
so I can actually go ahead and use JSON dot loads operation, and here I will give my JSON string.

170
00:08:30,000 --> 00:08:37,000
And now this will basically be my past data is equal to this one right.

171
00:08:37,000 --> 00:08:44,000
And now what I am actually going to do after this is that I will go ahead and print my past data.

172
00:08:44,000 --> 00:08:48,000
And uh, I will also go ahead and see the type of it.

173
00:08:48,000 --> 00:08:54,000
So I'm going to see print type of past underscore data.

174
00:08:54,000 --> 00:08:59,000
So if I go ahead and execute it here you can see initially this was the my uh see it got converted into

175
00:08:59,000 --> 00:09:00,000
a string.

176
00:09:00,000 --> 00:09:01,000
So the class is string.

177
00:09:01,000 --> 00:09:04,000
Then again we converted back into a dictionary.

178
00:09:04,000 --> 00:09:04,000
Right.

179
00:09:04,000 --> 00:09:09,000
So JSON, whenever we get in the form of API from an API it will be in this particular string format.

180
00:09:09,000 --> 00:09:15,000
We can just load that particular information, convert that into a dictionary and perform data serialization.

181
00:09:15,000 --> 00:09:16,000
Okay.

182
00:09:16,000 --> 00:09:21,000
So this is one very good example of, uh, probably writing each and every thing over here.

183
00:09:21,000 --> 00:09:26,000
And, uh, this is what is all about deserialize data serialization.

184
00:09:26,000 --> 00:09:28,000
And we'll be using this a lot as we go ahead.

185
00:09:28,000 --> 00:09:29,000
Okay.

186
00:09:29,000 --> 00:09:33,000
Now let me just go ahead and talk about one more standard library, which is called as CSV.

187
00:09:33,000 --> 00:09:34,000
Okay.

188
00:09:34,000 --> 00:09:37,000
Whenever you need to work with a CSV file.

189
00:09:37,000 --> 00:09:37,000
Right.

190
00:09:37,000 --> 00:09:41,000
And there are a lot of files which will be learning and we'll be using pandas and all.

191
00:09:41,000 --> 00:09:44,000
Uh, there will be learning more different kind of operations and all.

192
00:09:44,000 --> 00:09:44,000
Okay.

193
00:09:44,000 --> 00:09:47,000
So I will go ahead and just import CSV.

194
00:09:47,000 --> 00:09:51,000
And now with open right with open.

195
00:09:51,000 --> 00:09:59,000
And here I'm going to specifically use let's say I will I will create an example dot CSV file okay.

196
00:09:59,000 --> 00:10:01,000
And then let me just go ahead and write the mode.

197
00:10:01,000 --> 00:10:01,000
Right.

198
00:10:01,000 --> 00:10:05,000
So open has first of all you need to give the file name.

199
00:10:05,000 --> 00:10:07,000
Then then what mode you really want to open it.

200
00:10:07,000 --> 00:10:10,000
Let's say I want to more open this in write mode.

201
00:10:10,000 --> 00:10:12,000
So I will go ahead and write w.

202
00:10:12,000 --> 00:10:14,000
There is also something called as w plus mode.

203
00:10:14,000 --> 00:10:17,000
So w plus is nothing but a write append mode okay.

204
00:10:17,000 --> 00:10:21,000
And here I will go ahead and say hey use the new line as this.

205
00:10:21,000 --> 00:10:21,000
Okay.

206
00:10:21,000 --> 00:10:23,000
So it should be as this.

207
00:10:23,000 --> 00:10:25,000
And I will open this as a file object okay.

208
00:10:26,000 --> 00:10:34,000
Now by using the CSV dot, I will go ahead and write inside this particular file.

209
00:10:34,000 --> 00:10:36,000
So there is a writer function right.

210
00:10:36,000 --> 00:10:37,000
We will write inside this file.

211
00:10:37,000 --> 00:10:39,000
And this will basically be my writer.

212
00:10:40,000 --> 00:10:44,000
Now I can go ahead and take any data and write each and every row.

213
00:10:44,000 --> 00:10:50,000
So here what I'm going to do I'm going to basically write writer dot write row okay.

214
00:10:50,000 --> 00:10:53,000
And let me just go ahead and give the row.

215
00:10:53,000 --> 00:10:56,000
So first row will be my column names name comma age.

216
00:10:56,000 --> 00:10:59,000
I have to give this in the form of list or collection.

217
00:10:59,000 --> 00:11:06,000
Then I will go ahead and write a writer dot write row and I will start writing my second row.

218
00:11:06,000 --> 00:11:08,000
And now I will start with my data.

219
00:11:08,000 --> 00:11:10,000
So let's say crush.

220
00:11:10,000 --> 00:11:19,000
And here I will be able to put um 32 or I'll go ahead and put integer right now this, in short, what

221
00:11:19,000 --> 00:11:23,000
it is going to do is that it is going to create an example dot csv file.

222
00:11:23,000 --> 00:11:24,000
Okay.

223
00:11:24,000 --> 00:11:26,000
And there it is going to insert two records.

224
00:11:26,000 --> 00:11:29,000
One is with the column name name comma age.

225
00:11:29,000 --> 00:11:31,000
And the next one is with respect to the data.

226
00:11:31,000 --> 00:11:32,000
Okay.

227
00:11:32,000 --> 00:11:36,000
Now what I'm actually going to do I'm going to write with open okay.

228
00:11:36,000 --> 00:11:39,000
And here I'm going to specifically write example dot csv.

229
00:11:39,000 --> 00:11:43,000
Because once I create this particular CSV file it is in the right mode, right?

230
00:11:43,000 --> 00:11:44,000
I'll create the CSV file.

231
00:11:44,000 --> 00:11:46,000
Now we'll try to read it okay.

232
00:11:46,000 --> 00:11:49,000
Now I'll change the mode to R okay.

233
00:11:49,000 --> 00:11:55,000
And now what I will do I will basically read the entire file the CSV file.

234
00:11:55,000 --> 00:11:57,000
So I'll create a reader is equal to CSV.

235
00:11:58,000 --> 00:11:59,000
Dot reader function is there.

236
00:11:59,000 --> 00:12:01,000
And I will give the file name okay.

237
00:12:01,000 --> 00:12:03,000
Whatever file is over here.

238
00:12:03,000 --> 00:12:06,000
Then since I will be having multiple low.

239
00:12:06,000 --> 00:12:12,000
So I will go ahead and write for row in row reader and we will just go ahead and print the rows.

240
00:12:12,000 --> 00:12:15,000
So what we have actually done we have created a CSV file.

241
00:12:15,000 --> 00:12:16,000
We have written two records.

242
00:12:16,000 --> 00:12:20,000
And then now we are opening the same CSV file and we are reading the data.

243
00:12:20,000 --> 00:12:20,000
Right.

244
00:12:20,000 --> 00:12:22,000
So let's go ahead and execute it.

245
00:12:22,000 --> 00:12:23,000
So here you can see.

246
00:12:23,000 --> 00:12:27,000
Let's see first of all whether the CSV file is created or not see example dot CSV is created.

247
00:12:27,000 --> 00:12:29,000
And here is my two records.

248
00:12:29,000 --> 00:12:32,000
You can open Also open this with Excel file.

249
00:12:32,000 --> 00:12:32,000
Okay.

250
00:12:32,000 --> 00:12:36,000
And now I'm reading this and I'm also displaying it over here.

251
00:12:36,000 --> 00:12:37,000
So perfect.

252
00:12:37,000 --> 00:12:40,000
Uh, this is one very important function that we can actually use.

253
00:12:40,000 --> 00:12:41,000
Okay.

254
00:12:41,000 --> 00:12:44,000
Uh, so uh, you can actually go ahead with, uh, seeing this.

255
00:12:44,000 --> 00:12:44,000
Okay.

256
00:12:44,000 --> 00:12:50,000
Now, one more function that I or one more, uh, standard library that we specifically use is date

257
00:12:50,000 --> 00:12:51,000
time.

258
00:12:51,000 --> 00:12:51,000
Okay.

259
00:12:51,000 --> 00:12:58,000
Now, with respect to date time, you can go ahead and import something like this from date time import.

260
00:12:58,000 --> 00:12:59,000
So date time is again a module.

261
00:12:59,000 --> 00:13:02,000
So I'll be importing from date time import date time.

262
00:13:02,000 --> 00:13:08,000
Along with that I can also import one more function which is called as time delta okay time delta.

263
00:13:09,000 --> 00:13:13,000
Now if I want the current time so I can go ahead and write date time dot.

264
00:13:13,000 --> 00:13:14,000
Now okay.

265
00:13:14,000 --> 00:13:20,000
So date time dot now will specifically give you the current time or current date okay.

266
00:13:20,000 --> 00:13:24,000
Then let's go ahead and print now okay.

267
00:13:24,000 --> 00:13:26,000
Let's go ahead and print now.

268
00:13:26,000 --> 00:13:33,000
And then uh, let's say uh I want to probably um, you know currently what is the time.

269
00:13:33,000 --> 00:13:34,000
And yesterday one day back.

270
00:13:34,000 --> 00:13:34,000
Right.

271
00:13:34,000 --> 00:13:36,000
So I can actually use time delta.

272
00:13:36,000 --> 00:13:43,000
So let's say yesterday I will go ahead and write is equal to now minus time Delta.

273
00:13:43,000 --> 00:13:45,000
Let's say that I want to go ahead and calculate a difference.

274
00:13:45,000 --> 00:13:47,000
And here I'm going to use one parameter.

275
00:13:47,000 --> 00:13:48,000
Days is equal to one.

276
00:13:48,000 --> 00:13:51,000
I'm saying that hey go one day back.

277
00:13:51,000 --> 00:13:54,000
And with respect to that just try to calculate the delta itself.

278
00:13:54,000 --> 00:13:55,000
Right.

279
00:13:55,000 --> 00:13:58,000
So uh like one day back what will be the time.

280
00:13:58,000 --> 00:13:59,000
And all right.

281
00:13:59,000 --> 00:14:01,000
So here I'm going to just go ahead and print yesterday.

282
00:14:03,000 --> 00:14:09,000
So if I go ahead and execute right now the time is 1137 and I can see the watch, it is perfectly fine.

283
00:14:09,000 --> 00:14:13,000
And yesterday, one day back it was 1137.

284
00:14:13,000 --> 00:14:15,000
I'm just doing currently divided by minus time.

285
00:14:15,000 --> 00:14:19,000
Delta of day is equal to one and yesterday time will be something like this right?

286
00:14:19,000 --> 00:14:23,000
So this is also one very good thing uh, with respect to this.

287
00:14:23,000 --> 00:14:24,000
Okay.

288
00:14:24,000 --> 00:14:29,000
Now, uh, one more standard library that we can specifically use and which is common is nothing but

289
00:14:29,000 --> 00:14:29,000
time.

290
00:14:29,000 --> 00:14:31,000
Okay, let's say I'm writing a code.

291
00:14:31,000 --> 00:14:35,000
I want to make the program sleep for some couple of seconds.

292
00:14:35,000 --> 00:14:35,000
Right.

293
00:14:35,000 --> 00:14:37,000
So for that I can use time.

294
00:14:37,000 --> 00:14:38,000
So import time.

295
00:14:38,000 --> 00:14:44,000
And let's say if I go ahead and print time dot time okay.

296
00:14:44,000 --> 00:14:53,000
And uh let me just go ahead and write, say hey, after this you just sleep for two seconds, sleep

297
00:14:53,000 --> 00:14:59,000
for two seconds, and then again, let's go ahead and print time dot time.

298
00:15:00,000 --> 00:15:03,000
Now if I go ahead and execute it uh, here you can see it is sleeping for two seconds.

299
00:15:03,000 --> 00:15:06,000
And then I got this specific thing right.

300
00:15:06,000 --> 00:15:09,000
Uh, this is, uh, what it is more about.

301
00:15:09,000 --> 00:15:11,000
And, uh, you will be able to see that.

302
00:15:11,000 --> 00:15:11,000
Wow.

303
00:15:11,000 --> 00:15:14,000
We are able to do some amazing thing with respect to this.

304
00:15:14,000 --> 00:15:17,000
We are able to make the program sleep for some seconds also.

305
00:15:17,000 --> 00:15:18,000
Okay.

306
00:15:18,000 --> 00:15:25,000
now, uh, one more, uh, common libraries that we will be using is something called as regular expression.

307
00:15:25,000 --> 00:15:33,000
So for regular expression, uh, uh, there is a library again which is called as import re okay.

308
00:15:34,000 --> 00:15:41,000
Now regular expression basically helps you to match a specific, uh, expression in a top of a sentence.

309
00:15:42,000 --> 00:15:45,000
You can do it on an entire data set and do many things.

310
00:15:45,000 --> 00:15:47,000
Let's say that I define a pattern.

311
00:15:47,000 --> 00:15:47,000
Okay.

312
00:15:47,000 --> 00:15:52,000
Now, with respect to this particular pattern, uh, I'm saying, hey, use this pattern.

313
00:15:53,000 --> 00:15:54,000
Something like this.

314
00:15:54,000 --> 00:15:54,000
Okay.

315
00:15:54,000 --> 00:15:56,000
I'll say, hey, go ahead and use this.

316
00:15:56,000 --> 00:15:58,000
Uh, it will be mine.

317
00:15:58,000 --> 00:16:00,000
Uh, slash d plus.

318
00:16:00,000 --> 00:16:04,000
Okay, let's say this is the pattern that I select, and I'm having a text.

319
00:16:04,000 --> 00:16:05,000
Okay.

320
00:16:05,000 --> 00:16:08,000
There are 123 apples.

321
00:16:09,000 --> 00:16:09,000
Okay.

322
00:16:10,000 --> 00:16:14,000
Then I will say let's go ahead and match whether this pattern is there or not okay.

323
00:16:14,000 --> 00:16:16,000
Digit plus okay.

324
00:16:16,000 --> 00:16:18,000
Whether this pattern is there or not.

325
00:16:18,000 --> 00:16:22,000
So in order to do that I will just go ahead and write Ari Dot search.

326
00:16:22,000 --> 00:16:27,000
And here we are going to use pattern comma text okay.

327
00:16:27,000 --> 00:16:30,000
So let's go ahead and print match.

328
00:16:31,000 --> 00:16:35,000
Match dot group okay.

329
00:16:35,000 --> 00:16:38,000
So if I go ahead and use dot group.

330
00:16:38,000 --> 00:16:43,000
So here you'll be able to see the answer where this specific D plus pattern is getting matched.

331
00:16:43,000 --> 00:16:47,000
So here you can see that 123 is present and D is basically digits right.

332
00:16:47,000 --> 00:16:50,000
We are just going to see that where digits are specifically there.

333
00:16:50,000 --> 00:16:50,000
Right.

334
00:16:50,000 --> 00:16:52,000
And we are going to get over here.

335
00:16:52,000 --> 00:16:55,000
If I go ahead and write over here another one four, five, six.

336
00:16:55,000 --> 00:17:01,000
So here we'll be able to see that after getting this continuous digit match, then, uh, it will stop

337
00:17:01,000 --> 00:17:04,000
over there because the match is successfully done over here.

338
00:17:04,000 --> 00:17:04,000
Right.

339
00:17:04,000 --> 00:17:06,000
So match is successfully done.

340
00:17:06,000 --> 00:17:09,000
So we don't have to, you know, uh, check the forward one.

341
00:17:09,000 --> 00:17:13,000
So this is some of the things that we specifically use in regular expression.

342
00:17:13,000 --> 00:17:16,000
Now this can be lot more complicated.

343
00:17:16,000 --> 00:17:18,000
It is not you always have to probably use this.

344
00:17:18,000 --> 00:17:18,000
Right.

345
00:17:18,000 --> 00:17:19,000
It is other things.

346
00:17:19,000 --> 00:17:21,000
Also, you can probably check.

347
00:17:21,000 --> 00:17:25,000
Okay, so I hope, uh, you are able to understand this.

348
00:17:25,000 --> 00:17:27,000
Uh, these are some of the standard libraries.

349
00:17:27,000 --> 00:17:30,000
Again, they are lot, lot libraries as I always said.

350
00:17:30,000 --> 00:17:31,000
Okay.

351
00:17:31,000 --> 00:17:32,000
There is no limit as such.

352
00:17:32,000 --> 00:17:34,000
It is up to you how much you can try.

353
00:17:34,000 --> 00:17:39,000
You can practice, keep on practicing and based on different different scenarios we can use this.

354
00:17:39,000 --> 00:17:41,000
So I hope you like this particular video.

355
00:17:41,000 --> 00:17:42,000
And this was it for my side.

356
00:17:42,000 --> 00:17:43,000
I'll see you in the next video.

357
00:17:43,000 --> 00:17:43,000
Thank you.

