"""
with open() as 名字
student.txt
hello world
word ppt excel
?
"""
## 读取student的内容复制到b中
with open("student.txt","r") as f,open("b.txt","w+") as f2:
f2.write(f.read())
f2.seek(0,0)##因为读取后指针在最后所以需要将指针移动到开头
print(f2.read())
原文:https://www.cnblogs.com/continue-student/p/14694970.html