6.2 file 写文件
时间:2017-11-10 12:33:24
收藏:0
阅读:208
#!/usr/bin/env python # -*- coding:utf-8 -*- #@Time :2017/10/27 22:15 #@Author :zhouyuyao #@File :file_write.py import codecs # mode 有几个参数需要注意: # r 读 # w 写 # b 二进制 # a 追加 f=codecs.open(‘w2.txt‘,‘a‘) f.write(‘Hello world\n‘) f.write(‘Hello {0}\n‘.format(‘zhouyuyao‘)) f.write(‘Hello %s\n‘ %‘future‘) f.write(‘Never give up\n‘) f.write(‘Never forget why you started \n‘) f.close()
原文:http://shaoniana.blog.51cto.com/11471609/1980532
评论(0)