题目内容

在当前目录存在文本文件test.txt,内容是:Life is short, you need Python.Simple is better than complex.执行下列语句输出得到的结果是以下哪一项?

A. 输出为空。
B. Simple is better than complex.
C. Life is short, you need Python.
D. you need Python.

查看答案
更多问题

下面哪个不是Python合法的标识符

A. int32
B. 40XL
C. self D
D. __name__

程序如下:try:number = int(input("请输入数字:"))print("number:",number)print("=======hello======")except Exception as e:# 报错错误日志print("打印异常详情信息: ",e)else:print("没有异常")finally:#关闭资源print("finally")print("end")输入的是 1a 结果是:

A. number: 1打印异常详情信息: invalid literal for int() with base 10:finallyend
B. 打印异常详情信息: invalid literal for int() with base 10:finallyend
C. ========hello===========打印异常详情信息: invalid literal for int() with base 10:finallyEnd
D. 以上都正确

定义类如下class Hello():def __init__(self,name)self.name=namedef showInfo(self)print(self.name)下面代码能正常执行的ABCD

A. h = Helloh.showInfo()
B. h = Hello()h.showInfo(‘张三’)
C. h = Hello(‘张三’)h.showInfo()
D. h = Hello(‘admin’)showInfo

执行以下代码后的输出结果是哪一个选项?my_list=[s.lower()forsin'Lifeisshort,youneedPython.'.split('')]print('short'inmy_list)print(my_list[5])

A. Falsepython.
B. True python.
C. True Python
D. FalsePython

答案查题题库