python写文件
1 from time import sleep 2 myfile = open(r'C:\Users\Administrator\Desktop\1.txt','w')#默认的打开权限就是r 3 #read->r 4 #write->w 5 #binary->b 6 myfile.write('abcabcabcabcabcabc\n') 7 myfile.write('------------------\n')# 8 myfile.flush() 9 sleep(7) 10 #代表程序要休眠 11 print('休息结束') 12 myfile.close() 13 #覆盖掉 14 #跟着 15 #换行重起一行