K12教育赛事综合服务平台
聚乐之家官方网站
下载聚乐之家官方App
专注青少年竞赛题库网站
假设所有代码中的测试文件均已正确创建并存在,下列四段使用seek方法的Python代码中,无法正常运行的是?
# 文本模式打开文件 f = open('test.txt', 'r') f.seek(5) print(f.tell()) f.close()
# 二进制模式打开文件 f = open('test.txt', 'rb') f.seek(3, 1) print(f.tell()) f.close()
f = open('test.txt', 'rb') f.seek(-2, 2) print(f.tell()) f.close()
# 文本模式打开文件 f = open('test.txt', 'r') f.seek(2, 1) print(f.read()) f.close()