• 2021-04-14 问题

    分析和运行下面程序,写出运行结果()。f=open(sx7-...te(上海 西安)f.close()

    分析和运行下面程序,写出运行结果()。f=open(sx7-...te(上海 西安)f.close()

  • 2022-06-10 问题

    若文件data.txt中有字符串“飞雪连天射白鹿”,则不能将"笑书神侠倚碧鸳"写入该字符串后面的语句是( ) A: f=open("data.txt",'a')f.write("笑书神侠倚碧鸳")f.close() B: f=open("data.txt",'w+')f.write("笑书神侠倚碧鸳")f.close() C: f=open("data.txt",'w+')f.writelines(["飞雪连天射白鹿","笑书神侠倚碧鸳"])f.close() D: f=open("data.txt",'w')f.write("飞雪连天射白鹿笑书神侠倚碧鸳")f.close()

    若文件data.txt中有字符串“飞雪连天射白鹿”,则不能将"笑书神侠倚碧鸳"写入该字符串后面的语句是( ) A: f=open("data.txt",'a')f.write("笑书神侠倚碧鸳")f.close() B: f=open("data.txt",'w+')f.write("笑书神侠倚碧鸳")f.close() C: f=open("data.txt",'w+')f.writelines(["飞雪连天射白鹿","笑书神侠倚碧鸳"])f.close() D: f=open("data.txt",'w')f.write("飞雪连天射白鹿笑书神侠倚碧鸳")f.close()

  • 2022-07-28 问题

    一个文本文件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()

    一个文本文件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()

  • 2022-07-24 问题

    执行语句f=open("f.txt","w")后,不可以执行的语句是() A: f.write("123") B: f.close() C: f.read() D: f.flush()

    执行语句f=open("f.txt","w")后,不可以执行的语句是() A: f.write("123") B: f.close() C: f.read() D: f.flush()

  • 2022-06-16 问题

    f=open("test.txt","wt") f.write("abc") f.seek(2,0) f.write("123") f.close() 程序时错误的,因为seek只能用在二进制文件操作中

    f=open("test.txt","wt") f.write("abc") f.seek(2,0) f.write("123") f.close() 程序时错误的,因为seek只能用在二进制文件操作中

  • 2021-04-14 问题

    正常执行文件,关闭操作时嗯F close函数返回值是

    正常执行文件,关闭操作时嗯F close函数返回值是

  • 2022-06-16 问题

    下列程序的输出结果是()。f=open('out.txt','w+')f.write('Python') f.seek(0)c=f.read(2) print() f.close() A: Pyth B: Python C: Py D: th

    下列程序的输出结果是()。f=open('out.txt','w+')f.write('Python') f.seek(0)c=f.read(2) print() f.close() A: Pyth B: Python C: Py D: th

  • 2022-06-16 问题

    下列程序的输出结果是()。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

    下列程序的输出结果是()。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

  • 2021-04-14 问题

    中国大学MOOC: 分析和运行下面程序,写出运行结果( )。f=open(sx7-1.txt,w)f.write(北京)f.write(上海)f.write(西安)f.write( 北京 )f.write(上海 西安 )f.close()

    中国大学MOOC: 分析和运行下面程序,写出运行结果( )。f=open(sx7-1.txt,w)f.write(北京)f.write(上海)f.write(西安)f.write( 北京 )f.write(上海 西安 )f.close()

  • 2022-05-26 问题

    ​import random‌​‌​f = open(‘data.txt’,‘w+’)‌​for i in range(100000):‌​f.write(str(random.randint(1,100)) + ‘\n’)‌​‌​f.seek(0)‌​print(f.read())‌​f.close()‌​问:创建的data.txt文件中有多少行‌​‌

    ​import random‌​‌​f = open(‘data.txt’,‘w+’)‌​for i in range(100000):‌​f.write(str(random.randint(1,100)) + ‘\n’)‌​‌​f.seek(0)‌​print(f.read())‌​f.close()‌​问:创建的data.txt文件中有多少行‌​‌

  • 1 2 3 4 5 6 7 8 9 10