一个文本文件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()
参考答案
继续答题:下一题