單項選擇題在Python中,如何檢查一個變量是否存在?()

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


您可能感興趣的試卷

你可能感興趣的試題

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

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

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

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

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

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

4.單項選擇題在Python中,如何將一個字符串轉(zhuǎn)換成小寫?()

A.str.lower()
B.str.tolower()
C.lowercase(str)
D.str.small()

5.單項選擇題在Python中,如何暫停代碼執(zhí)行幾秒?()

A.sleep(seconds)
B.time.sleep(seconds)
C.delay(seconds)
D.wait(seconds)