|
发表于 2025-2-28 10:54:15
|
显示全部楼层
请回复您的答案^_^
-------- 问答题 --------
第 0 题的答案是:
第 1 题的答案是:
第 2 题的答案是:read 3 bytes
第 3 题的答案是:1 line
第 4 题的答案是:
第 5 题的答案是:
第 6 题的答案是:may truncate the file
第 7 题的答案是:ok
第 8 题的答案是:position
第 9 题的答案是:End of the file
第 10 题的答案是:f.tell()
-------- 动动手 --------
请将第 0 题的代码写在下方:
f = open('FishC.txt','r')
content = f.readline(15)
f.close()
new_f = open('FishD.txt','w')
new_f.write(content)
new_f.close()
请将第 1 题的代码写在下方:
new_f.close()
f = open('FishC.txt','r+')
f.truncate(15)
f.close()
请将第 2 题的代码写在下方:
file = open('open_myself.py','r')
for each in file:
print(each)
file.close()
请将第 3 题的代码写在下方:
test = open("test.jpg","a")
target = open("target.zip","r")
content = target.read()
test.write(content)
test.close()
target.close() |
|