单项选择题
在Python中,如何使用条件表达式(三元运算符)?()
A.x if condition else y
B.condition ?x :y
C.if condition:x else:y
D.condition then x else y
点击查看答案&解析
相关考题
-
单项选择题
在Python中,如何检查一个文件是否存在?()
A.os.path.exists(path)
B.file.exists(path)
C.path.exists(file)
D.os.exists(file) -
单项选择题
在Python中,如何判断一个字符串是否以某个子字符串结束?()
A.str.endswith(substring)
B.endswith(str,substring)
C.str.hasSuffix(substring) -
单项选择题
在Python中,如何判断一个字符串是否以某个子字符串开始?()
A.str.startswith(substring)
B.str.beginswith(substring)
C.str.hasPrefix(substring)
D.startswith(str,substring)
