11.python 中用来抛出异常的语句是( )
A. try 语句
B. break 语句
C. def 语句
D. continue 语句
https://www.shititong.cn/cha-kan/shiti/00045642-89aa-fb66-c0c9-4cc241d27c00.html
点击查看答案
25.以下哪个字符在字符串输出时能起到换行的作用( )
A. 'la
B. \t
Y
C. 'in'
D. 10'
https://www.shititong.cn/cha-kan/shiti/00045642-8980-8e72-c0c9-4cc241d27c00.html
点击查看答案
20.阅读以下程序,填写运行结果
https://www.shititong.cn/cha-kan/shiti/00045648-dd51-984e-c0c9-4cc241d27c00.html
点击查看答案
13.在对 csv 文件进行写操作时,可通过设置以下哪个参数来避免出现空行( )
A. enter
B. newlines
C. newline
D. encoding
https://www.shititong.cn/cha-kan/shiti/00045642-89ac-550f-c0c9-4cc241d27c00.html
点击查看答案
16.如果要对 E 盘 myfile 目录下的文本文件 abc.txt 进行读操作,文件打开方式应为( )
A. open(”e:llmyfilellabc.txt”, ”x” )
B. open(”e:\myfilellabc.txt”, ”r” )
C. open(”e:\lmyfilellabc.txt”,”r+”)
D. open( ”e:\myfilellabc.txt”, ”rb” )
解析:这个问题考察的是文件的打开方式。在 Windows 操作系统中,文件路径通常使用反斜杠"\"作为目录分隔符。
选项A中的"open("e:llmyfilellabc.txt", "x")"是错误的,因为"x"模式表示创建新文件,而不是读取文件。
选项B中的"open("e:\myfilellabc.txt", "r")"是正确的。"r"模式表示以只读方式打开文件,这样可以对 abc.txt 文件进行读操作。
选项C中的"open("e:\lmyfilellabc.txt","r+")"也是错误的,因为路径中多了一个"l"字符。
选项D中的"open("e:\myfilellabc.txt", "rb")"是错误的,因为"rb"模式表示以二进制只读方式打开文件,而题目要求的是文本文件的读操作。
https://www.shititong.cn/cha-kan/shiti/00045642-89ad-74e9-c0c9-4cc241d27c00.html
点击查看答案
41.执行如下代码,则程序的运行结果是
https://www.shititong.cn/cha-kan/shiti/00045648-dd48-76a1-c0c9-4cc241d27c00.html
点击查看答案
49.已知字符串 s='1234',则表达式 str(s.index('3')+s.count('34'))*len(s)的值为‘ ’
https://www.shititong.cn/cha-kan/shiti/00045648-dd45-5221-c0c9-4cc241d27c00.html
点击查看答案
16.已知字典 dic={('小明',1):[90,80],('小红'2):[65,88],('小琳',3):[90,100]},则表达式'小明' indic 的值为
https://www.shititong.cn/cha-kan/shiti/00045648-dd4b-fe27-c0c9-4cc241d27c00.html
点击查看答案
6.已知列表 lst=[1,'a',2,'b,3,c],则表达式 lst[0:1]的值为 ( )
A. [1]
B. 1
C. [1,a]
D. [1,’a’]
https://www.shititong.cn/cha-kan/shiti/00045642-8996-b112-c0c9-4cc241d27c00.html
点击查看答案
4.对于序列 numbers=[1,2,3,4,5,6,7,8,9,10],以下相关操作中哪一个得到的结果中包含数字 6?
A. >>> numbers[6]
B. >>> numbers[5:-1]
C. >>> numbers[-4:-1]
D. >>> numbers[0: 5]
https://www.shititong.cn/cha-kan/shiti/00045642-8995-64c8-c0c9-4cc241d27c00.html
点击查看答案