單項選擇題在Python中,如何創(chuàng)建一個裝飾器?()

A.def decorator(func)
B.@decorator
C.with decorator
D.A和B都對


您可能感興趣的試卷

你可能感興趣的試題

1.單項選擇題在Python中,如何獲取一個模塊的所有函數(shù)和變量?()

A.dir(module)
B.module.__all__
C.module.__dict__
D.module.list()

2.單項選擇題在Python中,如何創(chuàng)建一個匿名函數(shù)?()

A.lambda
B.anonymous
C.func
D.none

4.單項選擇題在Python中,如何獲取一個對象的內(nèi)存地址?()

A.id(obj)
B.address(obj)
C.obj.address()
D.obj.id()

5.單項選擇題在Python中,如何生成一個0到1之間的隨機(jī)浮點(diǎn)數(shù)?()

A.random.random()
B.random.uniform(0,1)
C.random.randint(0,1)
D.A和B都對