但如果輸入的 text 不是10 進位的數字的話程式就會拋出ValueError 例外,此時初學者可能會 try…except… 這樣寫:. def str_to_int(text): try: return ...
確定! 回上一頁