Welcome back!
In this video, I'm going to go over of try and except statements and the importance of using them when dealing with files using Python. So if you're ready, let's get started!
Try statements are statements that will "try" to run a certain block of code, but if the code fails, it will run the "except" or "finally" clause, hence the name "try" statement. Every try clause is required to have at least one "except" or "finally" clause in order to run correctly.
Now when dealing with files, it is considered best practice to always have your file handling code between try statements. This will ensure if a file doesn't exist or if you get a problem for some reason because of the file, your program won't crash.
Chapters:
00:00 - Intro
00:09 - Errors in our code
00:35 - Finding the errors
01:00 - Using "try" statements
02:48 - Outro
Tags:
==========================
programming, python, coding, learn how to program, learning python, how to program in python, program using python, python programming, programming tutorials, learn programming, coding tutorials, programming for beginners, how to code, programming languages, coding for beginners, free coding courses, free coding tutorials, free programming courses, free programming tutorials, try and except python, python error handling, python exceptions, try except tutorial, python try except, handling errors in python, python try except example, prevent program crashes python, python error catching, try else python, python programming, python beginners, python try except block, exception handling python, python coding tips, python try except syntax