以下程序的输出结果是: 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
- 以下程序输出到文件textcsv里的结果是: fo = open(“textcsv”,‘w’) x = [90,87,93] z = [] for y in x: z.append(str(y)) fo.write(","join(z)) fo.close()
- 关于下面代码中的变量x,以下选项中描述正确的是。 fo = open(fname, "r") for x in fo: print(x) fo.close()
- 文件dat.txt里的内容如下:QQ&Wechat Google & Baidu以下程序的输出结果是fo = open("dat.txt", 'r') print(fo.read(7).rstrip()) fo.close()
- 以下程序输出到文件text.csv里的结果是: fo=open("text.csv",'w') x=[90,87,93] fo.write(",".join(str(x))) fo.close() A: [90,87,93] B: 90,87,93 C: ,9,0,,,,8,7,,,,9,3, D: [,9,0,,,,8,7,,,,9,3,]