#2
fall_bernana2020-10-13 09:13
|
程序代码:
with open("learning_python.txt") as file_object:
contents=file_object.read()
print(contents.rstrip())
for line in file_object:
print(line)
我在运行了2,3行输出文件内容后,再把file_object5,6分行输出,结果什么都输出不了,
然后我判断了下运行了2,3行语句的file_object是空的,难道read()函数读取变量后会将其清空吗,
还是说有什么原因呢?