單項(xiàng)選擇題在Python中,如何拋出自定義異常?()

A.raise MyException("message")
B.throw MyException("message")
C.exception MyException("message")
D.new Exception("message")


您可能感興趣的試卷

你可能感興趣的試題

1.單項(xiàng)選擇題在Python中,如何實(shí)現(xiàn)多線(xiàn)程?()

A.import threading
B.from concurrent.futures import ThreadPoolExecutor
C.from multiprocessing import Process
D.A和B都對(duì)

2.單項(xiàng)選擇題在Python中,如何檢查一個(gè)變量是否存在?()

A.if ’var’in locals()
B.if var
C.if exists(var)
D.if ’var’in globals()

3.單項(xiàng)選擇題在Python中,如何創(chuàng)建一個(gè)空集合?()

A.set ={}
B.set =set()
C.set =[]
D.set =()

4.單項(xiàng)選擇題在Python中,如何將一個(gè)列表轉(zhuǎn)換成字符串?()

A.’’.join(list)
B.str(list)
C.list.toString()
D.list.str()

5.單項(xiàng)選擇題在Python中,如何讀取文件的內(nèi)容?()

A.file.read()
B.file.readlines()
C.file.readline()
D.所有以上的選項(xiàng)