🎓 Welcome back to Digital Academy, the Complete Python Development Tutorial for Beginners, which will help you Learn Python from A to Z!
🖥️ How to Raise and Throw an Exception in Python? (Traceback in Python)
In Python programming, exceptions are raised when errors occur at runtime. But, as a Python developer, you can also choose to manually throw an exception, if a condition is met - and at any time. To raise such an exception, use the RAISE reserved keyword.
This statement RAISE in Python can be complemented with a Custom Exception. You can optionally define what kind of error to raise, and pass values to the exception to clarify why that exception was raised. Then, the program comes to a halt and it displays your exception to screen - offering clues about what went wrong and help debugging.
Raise built-in exception 'NameError'
raise NameError('An exception occured!')
Output:
Traceback (most recent call last):
File "stdin", line 1, in module
NameError: An exception occured!
Let's play this video, stick around and watch until the end of this video! 👍🏻
Digital Academy™ 🎓
***
☞ WATCH NEXT:
○ Data Types in Python - • DATA TYPES in Python (Numbers, Strings, Li...
○ Operators in Python - • OPERATORS in Python (Arithmetic, Assignmen...
○ IF Statements in Python - • CONDITIONAL Statements in Python (IF, ELIF...
○ FOR Loops in Python - • FOR Loop in Python (Syntax, Break, Continu...
📖 Blog: http://digital.academy.free.fr/blog
📖 [FULL Course] HOW TO Learn Python? Python Tutorial for Beginners: • 🐍 Python 101: Learn Python Basics for Abso...
📖 [PLAYLIST] Complete Python Development Course for Beginners: http://digital.academy.free.fr/playli...
🧑🎓 [COURSE] http://digital.academy.free.fr/courses
📘 [BOOK] Python for Absolute Beginners: https://amzn.to/3NvyOWV
🛒 Shopping and Discounts: http://digital.academy.free.fr/store
💌 Weekly Newsletter for Developers: https://www.getrevue.co/profile/digit...
#Python #Tutorial #Beginners #Shorts
***
♡ Thanks for watching and supporting ♡
Please Subscribe. Hit the notification bell.
Like, Comment and Share.
***
♡ FOLLOW US ♡
✧ http://digital.academy.free.fr/
✧ / digitalacademyy
✧ / digitalacademyfr
✧ / digital_academy_fr
✧ / digitalacademyonline
♡ SUPPORT US ♡
✧ http://digital.academy.free.fr/join
✧ http://digital.academy.free.fr/store
✧ http://digital.academy.free.fr/donate
✧ http://digital.academy.free.fr/subscribe
✧ / digital_academy
✧ https://www.buymeacoffee.com/digital_...
***
На этой странице сайта вы можете посмотреть видео онлайн How to RAISE an Exception in Python? (Traceback in Python) - Python Tutorial for Beginners длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Digital Academy 30 Апрель 2021, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 1,138 раз и оно понравилось 18 зрителям. Приятного просмотра!