python關於異常知識

python關於異常知識 try: s=input(「請輸入文件名進行打開」)#可能出錯的代碼 open("%s.py"%s) except BaseException:#所有異常的基類(萬金油) print(「無此文件」) try: print(ste) except NameError: #未聲明/初始化對象(沒有屬性) print(‘ste未定義’) try: s = input(「請輸入文
相關文章
相關標籤/搜索