摘要: csv是逗号间隔文本。 写操作 import csv #csv是一个内置文件 file=open('test.csv','w',encoding='utf8',newline='')#打开一个csv文件,newline取消换行符 w=csv.writer(file)#可以往w中进行写操作 w.wri 阅读全文
posted @ 2020-10-25 21:10 aslmer 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 拷贝文件和权限 import shutil source='./a.txt' dest ='../a.txt' shutil.copy(source, dest)#将文件从source copy到dest路径下 获取并打印本地时间 import time now=time.localtime()#格 阅读全文
posted @ 2020-10-25 20:35 aslmer 阅读(76) 评论(0) 推荐(0) 编辑
摘要: 1、使用open内置函数打开一个文件 file:相对路径或者绝对路径 mode:文件的模式。 r 只读 w只写 b:二进制 t:以文本形式打开等等 encoding:编码方式,windows下默认为gbk 例子: 读文件的例子 file=open('./a.txt',encoding='utf8') 阅读全文
posted @ 2020-10-25 16:28 aslmer 阅读(176) 评论(0) 推荐(0) 编辑