个文本文件test.txt的一行存储5个整数如下:1 3 56 67 34数之间用空格隔开,要读出这些整数的函数正确的是:
A: def read():f=open("test.txt","rt")st=f.readlines()for s in st:print(s)f.close()
B: def read():f=open("test.txt","rt")while true:s=f.read()if s!="":print(s)else:breakf.close()
C: def read():f=open("test.txt","rt")while true:s=f.readline()if s!="":print(s)else:breakf.close()
D: def read():f=open("test.txt","rt")s=f.readline()st=s.splist(" ")for s in st:print(s)f.close()
A: def read():f=open("test.txt","rt")st=f.readlines()for s in st:print(s)f.close()
B: def read():f=open("test.txt","rt")while true:s=f.read()if s!="":print(s)else:breakf.close()
C: def read():f=open("test.txt","rt")while true:s=f.readline()if s!="":print(s)else:breakf.close()
D: def read():f=open("test.txt","rt")s=f.readline()st=s.splist(" ")for s in st:print(s)f.close()
举一反三
- 一个文本文件test.txt的一行存储5个整数如下:1 3 56 67 34数之间用空格隔开,要读出这些整数的函数正确的是: A: def read(): f=open("test.txt","rt") while True: s=f.read() if s!="": print(s) else: break f.close() B: def read(): f=open("test.txt","rt") while True: s=f.readline() if s!="": print(s) else: break f.close() C: def read(): f=open("test.txt","rt") st=f.readlines() for s in st: print(s) f.close() D: def read(): f=open("test.txt","rt") s=f.readline() st=s.splist(" ") for s in st: print(s) f.close()
- 下列函数能够求n的阶乘n!的是 A: f = lambda n: n! B: def f(n): s=1 for i in range(n): s = s * i return s C: def f(n): s=1 for i in range(n,0,-1): s = s * i return s D: def f(n): if n == 1: return 1 else: return f(n-1)*n
- 下列程序的输出结果是()。f=open("w.txt","w+")f.write("LuxetVeritas")f.seek(7)s=f.read(3)f.close()print(s) A: tas B: Lux C: eri D: Ver
- 文件test.txt的内容是一段文本:hello,与以下代码在同一目录下,程序运行的输出结果是( )。f = open('test.txt')print(f.read(2))f.close( )
- 抵补利率平价公式是 A: Pd=S* Pf B: (St - St -1) / St -1 =(πd –πf) / (1+πf) C: SE=S* (1+id) / (1+if) D: F=S* (1+id) / (1+if)