ENع
الدرس 14 · Real programs

Exceptions

لم يُترجم بعد؛ يُعرض باللغة الإنجليزية

Some mistakes only show up while a program runs: dividing by zero, a missing file, text where a number should be. Python then raises an exception, an object that names what went wrong. Follow one through a seven-line program, share.py: it is raised inside a function, climbs out of the function's frame, and is caught by try and except so the program carries on. Then delete the try and watch Python print a traceback and stop.

12 دقيقة10 خطوات5 أسئلةIntermediate
شكل 14 · تفاعلي
جارٍ تحميل الرسم…
أو ← →

اختبار يتاح بعد الخطوة الأخيرة.