Python Exception Handling Tutorial for Beginners

  Рет қаралды 6,653

Dave Gray

Dave Gray

Күн бұрын

Пікірлер: 10
@utinthein7274
@utinthein7274 Жыл бұрын
Thank you, Sir.
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
You are very welcome
@muzhaffarhaydar7928
@muzhaffarhaydar7928 2 ай бұрын
thanks dave!
@khalilbenmeziane8836
@khalilbenmeziane8836 Жыл бұрын
thank you dave
@PeranMe
@PeranMe Жыл бұрын
Could you give a example of where finally isn’t… pointless, frankly? I mean, we could just leave it out and not indent what was once in the ”finally” code block and save *cough cough* maybe a dozen bytes of disk space. I’m sure there’s something clever here I’m missing, and I’d love to learn what it is. Thanks for another great video!
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
Sure! The example I always think of is closing a file no matter what happened before - error or not - other good examples in some answers here: stackoverflow.com/questions/11551996/why-do-we-need-the-finally-clause-in-python
@PeranMe
@PeranMe Жыл бұрын
@@DaveGrayTeachesCode aaah, I didn’t consider the case where you exit early! Thanks, much appreciated as always!
@johnaweiss
@johnaweiss 11 ай бұрын
How are these different? try: .... except: .... finally: print("no error") try: .... except: .... print("no error")
@Sedona119
@Sedona119 6 ай бұрын
finally: will always execute no matter what. If you put quit() or exit() in your code, the finally: would still be executed whereas if you just said print(), the print statement wouldn't run because the code would already be broken. finally: always executes, even after broken code but print() does not.
@johnaweiss
@johnaweiss 6 ай бұрын
@@Sedona119 So the print won't execute if there's a break. So break exits the entre function?
Python OOP (Object-Oriented Programming) Project for Beginners
30:19
BAYGUYSTAN | 1 СЕРИЯ | bayGUYS
36:55
bayGUYS
Рет қаралды 1,9 МЛН
Chain Game Strong ⛓️
00:21
Anwar Jibawi
Рет қаралды 41 МЛН
Mom Hack for Cooking Solo with a Little One! 🍳👶
00:15
5-Minute Crafts HOUSE
Рет қаралды 23 МЛН
Advanced Exception Handling in Python
12:06
NeuralNine
Рет қаралды 68 М.
Python File Handling for Beginners
22:40
Dave Gray
Рет қаралды 23 М.
This Is How You Do PROPER Exception Handling With FastAPI
6:09
ArjanCodes
Рет қаралды 20 М.
Recursion for Python Beginners with Recursive Function Examples
17:54
Please Master These 10 Python Functions…
22:17
Tech With Tim
Рет қаралды 235 М.
Python Closures for Beginners | Python tutorial
19:32
Dave Gray
Рет қаралды 9 М.
#63 Python Tutorial for Beginners | Exception Handling
15:59
Telusko
Рет қаралды 537 М.
BAYGUYSTAN | 1 СЕРИЯ | bayGUYS
36:55
bayGUYS
Рет қаралды 1,9 МЛН