• 2021-04-14
    中国大学MOOC: 分析和运行下面程序,写出运行结果( )。f=open(sx7-1.txt,w)f.write(北京)f.write(上海)f.write(西安)f.write(
    北京
    )f.write(上海
    西安
    )f.close()
  • 生成文件sx7-1.txt,文件内容为:北京上海西安 北京上海 西安

    内容

    • 0

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

    • 1

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

    • 2

      有以下程序 f=open(‘file.txt’ , ’a+’) f.write(‘abc’) f.seek(0,0) s=f.read() print(s) f.close() 若文本文件file.txt中原有内容为“hello”,则运行以上程序后,输出为( )

    • 3

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

    • 4

      执行下列语句如果会报错,错误在第几行? f=open("w.txt","w+") f.write("Lux et Veritas") f.seek(4,1)