'''f = open('yesterday','r',encoding='utf-8') # '读'print(f.encoding ) #打印文件编码print(f.name) #打印文件名print(f.seekable()) #判断能否指针移动print(f.readable()) #判断文件是否能读print(f.read()) #读取文件print(f.flush()) #刷新,后面示列print(f.close()) #关闭文件'''''''f = open('yesterday','r',encoding='utf-8')print(f.tell()) #查看指针位置 !单位是字符不是行print(f.seek(10)) #指定指针位置print(f.readline()) #从第一行的10字符后打印'''#f = open('yesterday','w',encoding='utf-8') # 'w' 写#print(f.write()) #只写 会覆盖原目录!!!!'''f = open('yesterday','a',encoding='utf-8') # 'a' 追加print(f.truncate(100))''' # 截断,不要再“写”下会清空文件'''f = open('yesterday','r',encoding='utf-8')print(f.readline()) #只读取第一行print(f.readline()) #只读去第二行.... #......第n行''''''count = 0 #打印前十行,循环f = open('yesterday','r',encoding='utf-8')for i in f: if count == 9: print('----打印前十行----') count +=1 continue print(i.strip()) count +=1 '''############################ 一个个出现'''import sys,timefor i in range(50): sys.stdout.write('#') sys.stdout.flush() time.sleep(0.1)'''#f = open('yesterday','r+',encoding='utf-8') #读写 写的会再文件最后 (常用)#f = open('yesterday','w+',encoding='utf-8') #写读 *#f = open('yesterday','a+',encoding='utf-8') #追加读 *
学习资料是老男孩视频,没钱等以后给老男孩补学费吧