We already talked about how to open a file in the python for reading, for writing, amending, whatever,
OK, and we checked the mods that are available, read, write, read, plus read, write, appending
for bindery and so on.
OK, now what if we want so frequent open and we want to open a file that does not exist actually.
So just three days time, the text we want to open it for.
OK, it's a simple example of actually no worries and I want to print the content of it.
As we learned previously, no big deal.
So read.
And so let's say that actually and check if it's working or not.
It sure did.
As you can see, we don't have this trick here.
So, yeah, no such file or directory.
OK, now how to solve such a thing?
We don't need such a thing.
Actually, this is ugly and this is not impractical.
So we would use the tried and we already saw that.
How to do the.
So try these.
OK, so far, so good, no.
Except this thing.
Now, remember when we bought just accept now.
No, this time we would put another value.
Now we would use something that found it like this, that is capital while not found like this.
So this means that the file is not found.
This is not just an error.
This is a specific error from this error.
Now, why is that?
Because we don't need just an error.
I want I will do this.
No, for example, if the pilot found, I will do a specific thing.
If the file there is errors with the eye, so the fight is existed, but the fight cannot be opened,
for example, I will do another things too.
OK, so if this happened, so I will print Bontempi by not Funt.
OK, so far so good.
Now another exception, except I don't know if there is a high or I or error this time I will print.
Oh I.
Oh I haven't.
OK no whatever.
OK, cool.
Now, let's check this if it is working or not.
This should be printing fine, not fun because the latest three is not fun.
OK, so let's open it, actually.
Yeah.
So far, so good.
It found.
Which means it worked correctly.
So which is better.
Actually this is fun.
Not found with handling the arrow or this is no such viral data and a lot finds a lot of text.
Actually this is actually this is not good.
And by the way, not just that actually this is more practical.
So it's not like printing just a simple file that found.
So, for example, if the phone that's found, I want to create it.
OK, and I want to put specific value inside it.
Then I will read it so you can see that there is some practical things here, actually.
And if the pilot error or whatever, and this happens for a lot of use cases, for a lot of situations,
whatever they are, you can just read about it.
So it's no big deal.
OK, then I will do specific things or whatever.
OK, yeah, you can see that.
By the way, I am writing the printer in a bad way, so it's trying and not print and you can see that
it didn't show me any all by the way, why this happened actually because that interpreter, the interpreter
is doing the things step by step.
So it will go to the right, then to the alphabet, then to the print and then to the left and so on.
So you can see that the sequentially and then check the syntax so you can see that the print is written.
There was error in the syntax, the print.
I wrote it in the wrong way.
So it didn't show anything here because except go to the pilot and it's stuck there.
So it didn't go to the except on the right.
OK, thanks for watching.
I will see you in the next picture.