Thaum twg koj yuav tsum tsa qhov kev zam?
Thaum twg koj yuav tsum tsa qhov kev zam?

Video: Thaum twg koj yuav tsum tsa qhov kev zam?

Video: Thaum twg koj yuav tsum tsa qhov kev zam?
Video: Vajtswv Thaum Twg Koj Mam Los-NKAUJ NTSEEG TAWM TSHIAB (VamNeebLauj NpawgLem) Original MV by Chichia 2024, Kaum ib hlis
Anonim

Yog vim li cas yuav tsum zam tsuas yog siv yog tias koj tsis tuaj yeem tswj qhov xwm txheej zoo li no (xav tias "tsis nco qab" lossis "lub computer raug hluav taws"). Ib txoj cai ntawm tus ntiv tes xoo yog rau siv kev zam ntawm ib yam dab tsi koj tsis tuaj yeem kwv yees li ib txwm. Piv txwv yog kev sib txuas database, cov ntaub ntawv ploj ntawm disk, thiab lwm yam.

Tom qab ntawd, ib tug kuj yuav nug, nws txhais li cas los tsa ib qho kev zam?

3.3 Kev zam . Nce ib qho kev zam yog ib qho txheej txheem rau cuam tshuam qhov kev ua haujlwm ib txwm muaj nyob rau hauv ib qho program, qhia tias qee qhov xwm txheej tshwj xeeb tau tshwm sim, thiab rov qab ncaj qha mus rau ib feem ntawm qhov kev pab cuam uas raug xaiv los ua rau qhov xwm txheej ntawd.

Ib sab saum toj no, ua li cas koj tsa qhov kev zam hauv Python? Python executes code tom qab sim nqe lus raws li ib feem "ib txwm" ntawm qhov kev pab cuam. Code uas ua raws li cov tsuas yog nqe lus yog qhov kev pab cuam teb rau ib qho twg kev zam nyob rau hauv qhov ua ntej sim clause. Raws li koj tau pom ua ntej, thaum syntactically raug cai sau rau hauv ib qho yuam kev , Python yuav pov ib qho kev zam yuam kev.

Ib tug kuj yuav nug, puas tsa qhov kev zam rau qhov kev zov me nyuam?

Cov nyhuv ntawm a tsa nqe lus yog rau tog twg los hloov qhov kev ua tiav hauv qhov sib txuam tshwj tsis yog suite, lossis rau nres qhov kev pab cuam vim tias tsis muaj qhov sib txuam tshwj tsis yog suite tau pom los daws cov kev zam . Cov kev zam khoom tsim los ntawm tsa tau muaj cov kab lus uas muab cov ntsiab lus yuam kev. Feem ntau, qhov no yog ib txoj hlua.

Yuav ua li cas thaum koj pov qhov Exception tshiab?

tshiab Exception () txhais tau tias koj tab tom tsim ib tshiab piv txwv ntawm Kev zam hom. Thaum twg koj hais pov tshiab Exception () qhov no txhais tau tias koj yog hais tias txav qhov kev tswj hwm rau tus neeg hu thiab tsis txhob ua cov lus hais ntxiv tom qab qhov no pov nqe lus.

Pom zoo: