第28401题 单选题
下列关于Python文件seek方法的代码中,无法正常执行的是?

假设所有代码中的测试文件均已正确创建并存在,下列四段使用seek方法的Python代码中,无法正常运行的是?

A
# 文本模式打开文件
f = open('test.txt', 'r')
f.seek(5)
print(f.tell())
f.close()
B
# 二进制模式打开文件
f = open('test.txt', 'rb')
f.seek(3, 1)
print(f.tell())
f.close()
C
f = open('test.txt', 'rb')
f.seek(-2, 2)
print(f.tell())
f.close()
D
# 文本模式打开文件
f = open('test.txt', 'r')
f.seek(2, 1)
print(f.read())
f.close()
程序运行统计
暂无判题统计
提交0次 正确率0.00%
答案解析