Python,文件

__author__ = '12711'
#-*- coding:utf-8 -*-
f=open("F",'r')#读文件
#f=open("F",'w')#写文件
f=open("F",'r+')#读写
#f=open("F",'w+')#写读
#f=open("F",'rb')#二进制文件
#f=open("F",'a+')#追加 读
#Data=f.read()
#print(f.readline())#读一行
#print(f.readline())
#for i in range(2):
# print(f.readline())
#第三行时改变输出
'''
cout=0
for i in f:
if cout==2:
print("hahah")
cout+=1
continue
print(i)
cout+=1
'''
#print(Data)
#f=open("F").read()
#print(f)
#f.write("\n我爱你\n")
#f.write("我喜欢你")
#print(f.tell())#看指针光标

f.close()#文件关闭
posted @ 2018-09-21 19:12  知冬  阅读(64)  评论(0编辑  收藏  举报