关于下述程序执行的结果的描述,正确的选项是: try: withopen('dat.txt','r')asf: ts=f.write('hello') print('openOK') except: print('fileoperationerror')
A. 如果data.csv文件存在,会打开这个文件,不显示输出fileoperationerror
B. 如果data.csv文件存在,不会显示输出fileoperationerror
C. 无论data.csv文件是否存在,都会显示输出fileoperationerror
D. 如果data.csv文件不存在,会创建一个文件,显示输出fileoperationerror
执行以下代码,Output.txt文件中的内容是: img1=[[80,85,82,82],[70,75,72,72]] withopen('output.txt','w')asf: foriminimg1: foriinim: f.write(str(i)+'') f.write('\n')
A. 8085828270757272
B. [80,85,82,82][70,75,72,72]
C. [80,85,82,82] [70,75,72,72]
D. 80858282 70757272
关于下述程序的描述,正确的选项是: withopen('data.csv','r')asf: ts=f.read() f.write('openOK')
A. 如果data.csv文件存在,会发生文件写操作错误
B. 如果data.csv文件不存在,这段程序也能正常执行
C. 如果data.csv文件存在但文件是空的,执行ts=f.read()会出错
D. 如果data.csv文件存在,执行这段程序就不会出错