|
发表于 2025-1-20 20:46:50
|
显示全部楼层
请回复您的答案^_^
-------- 问答题 --------
第 0 题的答案是:
yes, it will raise an error.the defualt behavior of open() is read an existed file.
第 1 题的答案是:
use flush()
第 2 题的答案是:
read three lines.
第 3 题的答案是:
one line.
第 4 题的答案是:
i don't know.
第 5 题的答案是:
the file is not text.
第 6 题的答案是:
'w' mode will empty the file content.
第 7 题的答案是:
yes.
第 8 题的答案是:
indicate current position of file pointer.
第 9 题的答案是:
End-of-File,use to indicate ending of text file.
第 10 题的答案是:
tell()
-------- 动动手 --------
请将第 3 题的代码写在下方:
print(__file__)
file_path = "/".join(__file__.split("\\")[:-1])
print(file_path)
file1_path = file_path + "/" + "test.jpg"
file2_path = file_path + "/" + "target.zip"
file1 = open(file1_path, "rb+")
file1.seek(0,2)
file2 = open(file2_path, "rb").read()
file1.write(file2)
file1.close()
|
|