f= open("F:/test.txt","r",encoding="UTF_8")
print(type(f))
print(f"读取10个字节的结果是:{f.read(10)}")
print(f"读取全部的结果是:{f.read()}")
first=f.readline()#读取一行
secend=f.readline()
thirst=f.readline()
print(first)
print(secend)
print(thirst)
for line in f:
print(line)
f.close()
f = open("F:/test1.txt","w",encoding="UTF-8")
f.write("Hello World!!")
f.flush()
f.close()
f = open("F:/test1.txt","w",encoding="UTF-8")
f.write("Hello World!!")
f.flush()
f = open("F:/test1.txt","a",encoding="UTF-8")
f.write("\nyqyyds")
f.close()