文件dat.txt里的内容如下:QQ&Wechat Google & Baidu以下程序的输出结果是fo = open("dat.txt", 'r') print(fo.read(7).rstrip()) fo.close()
举一反三
- 文件dat.txt内容如下:QQ&Wechat Google & Baidu以下程序的输出结果为______fo = open("dat.txt", 'r') line = fo.readline() print(len(line)) fo.close()
- 文件dat.txt内容如下:QQ&Wechat Google & Baidu下面程序输出结果为fo = open("dat.txt", 'r') lines = fo.readlines() print(len(lines)) fo.close()
- 文件text.txt里的内容如下:[br][/br]QQ&Wechat[br][/br]Google&Baidu[br][/br]以下程序的输出结果是()。[br][/br]fo=open("text.txt",'r')[br][/br]fo.seek(2)[br][/br]print(fo.read(8))[br][/br]fo.close() A: Wechat B: &WechatG C: WechatGo D: &Wechat
- 以下程序的输出结果是: fo = open(“texttxt”,‘w+’) x,y =‘this is a test’,‘hello’ fo.write(’{}+{} ’format(x,y)) print(fo.read()) fo.close()
- 以下程序的输出结果是:( )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