test1.txt文件第一行内容为:ABCDEFGHIJKLMN,执行下列代码后,运行结果是:fo = open("test1.txt", "r+")str = fo.read(5);position = fo.tell();print("当前文件位置 : ",position)
A: 5
B: 0
C: 1
D: 以上都不对
A: 5
B: 0
C: 1
D: 以上都不对
举一反三
- test1.txt文件第一行内容为:ABCDEFGHIJKLMN,执行下列代码后,运行结果是:fo = open("test1.txt", "r+")str = fo.read(5);position = fo.tell();print("当前文件位置 : ",position) A: 5 B: 0 C: 1 D: 以上都不对
- 以下程序的输出结果是:( )fo = open("text.txt",'w+')x,y ='this is a test','hello'fo.write('{}+{}\n'.format(x,y))print(fo.read())fo.close() A: this is a test hello B: this is a test C: this is a test,hello. D: this is a test+hello
- 以下程序的输出结果是: fo = open(“texttxt”,‘w+’) x,y =‘this is a test’,‘hello’ fo.write(’{}+{} ’format(x,y)) print(fo.read()) fo.close()
- 文件dat.txt里的内容如下:QQ&Wechat Google & Baidu以下程序的输出结果是fo = open("dat.txt", 'r') print(fo.read(7).rstrip()) fo.close()
- 以下文件操作方法,打开后能读取CSV格式文件的选项是:() A: fo = open("123.csv","a") B: fo = open("123.csv","w") C: fo = open("123.csv","x") D: fo = open("123.csv","r")