摘要: #!/usr/bin/python# -*- coding:utf-8 -*- import os import shutil os.remove(path) #删除文件shutil.rmtree(path) #删除文件夹及其子 可为'./dir' 也可'dir' 阅读全文
posted @ 2019-10-15 17:35 流星曳尾 阅读(1290) 评论(0) 推荐(0) 编辑
摘要: #!/usr/bin/python# -*- coding:utf-8 -*- import os fileName1 = 'a.txt'if os.path.exists(fileName1): file1 = open(fileName1,'w') file1.write('file1 exis 阅读全文
posted @ 2019-10-15 16:37 流星曳尾 阅读(200) 评论(0) 推荐(0) 编辑
摘要: #!/usr/bin/python# -*- coding:utf-8 -*- #!/usr/bin/python# -*- coding:utf-8 -*- file1 = open('a.txt','r')str = file1.read()file2 = open('b.txt','w')fi 阅读全文
posted @ 2019-10-15 15:58 流星曳尾 阅读(85) 评论(0) 推荐(0) 编辑
摘要: #!/usr/bin/python# -*- coding:utf-8 -*- open('a.txt','w+') 阅读全文
posted @ 2019-10-15 15:54 流星曳尾 阅读(162) 评论(0) 推荐(0) 编辑
摘要: #!/usr/bin/python# -*- coding:utf-8 -*- import os dir = './dir'os.mkdir(dir) 阅读全文
posted @ 2019-10-15 15:24 流星曳尾 阅读(134) 评论(0) 推荐(0) 编辑