#w权限所谓的覆盖是两次写,关闭之后算一次
"""
f = open("1.txt", "w")#open的文件默认权限是读,如果是写就是创建
f.write(" hello world\n hellow world")
f.close()
f = open("1.txt", "w")#open的文件默认权限是读,如果是写就是创建
print(f.read())#错误:对文件的操作要和文件的权限一致
f.close() #关闭,并保存修改
f = open("1.txt", "a")#a是追加
f.write("hello")
f.close() #关闭,并保存修改
f = open("1.txt", "a")#a是追加
f.writelines(["hello","a","b"])#同时写入多个东西,只能写入字符串
f.close() #关闭,并保存修改
f = open("1.txt")
print(f.readline())#就当前位置向下读
print(f.readline())
print(f.readline())
f.close()
f = open("1.txt")
for line in f.readlines():
print(line)
f.close()
f = open("1.jpg", "rb")
l = open("w.jpg", "wb")
l.write(f.read())
l.close()
f.close()
f = open("1.txt")
print(f.tell())#返回当前指针的位置
print(f.readline())
print(f.tell())
f.close()
f = open("1.txt")
print(f.readline())
print(f.seek(5, 0)) #移动指针的位置,第一个参数是移动指针的位数,第二个参数为0:开头、1:当前、2:结尾
print(f.readline())
f.close()
"""