上一页 1 2 3 4 5 6 ··· 17 下一页
摘要: import threading import time class MyThread(threading.Thread): def __init__(self): super(MyThread,self).__init__() #继承父类的初始化方法 def run(self): print("线 阅读全文
posted @ 2020-07-22 13:43 马蹄哒哒 阅读(224) 评论(0) 推荐(0)
摘要: import os for 文件夹路径,子文件夹路径,文件列表 in os.walk("E:\open"): #指定文件夹 for 文件 in os.scandir(文件夹路径): if 文件.name.endswith(".xlsx"): #指定文件类型 os.remove(文件夹路径+"\\"+ 阅读全文
posted @ 2020-07-18 17:02 马蹄哒哒 阅读(209) 评论(0) 推荐(0)
摘要: import os from datetime import datetime as dt os.chdir(r"E:\open") if not os.path.exists(r"E:\练习"): os.mkdir(r"E:\练习") for 文件夹路径,子文件夹路径,文件列表 in os.wal 阅读全文
posted @ 2020-07-16 15:31 马蹄哒哒 阅读(126) 评论(0) 推荐(0)
摘要: import os ls=[] for 文件夹路径,文件夹列表,文件列表 in os.walk(r"E:\open"): for 文件名 in os.scandir(文件夹路径): if 文件名.is_file(): 文件=open(文件名,'rb').read() if hash(文件) in l 阅读全文
posted @ 2020-07-16 15:29 马蹄哒哒 阅读(122) 评论(0) 推荐(0)
摘要: import zipfile import os from pathlib import Path os.chdir("E:\练习2") with zipfile.ZipFile(r"E:\练习1.zip","r") as f: for 文件名 in f.namelist(): 解压后的文件=Pat 阅读全文
posted @ 2020-07-16 14:30 马蹄哒哒 阅读(125) 评论(0) 推荐(0)
摘要: import zipfile with zipfile.ZipFile(r"E:\练习1.zip","r") as f: for 文件名 in f.namelist(): 信息=f.getinfo(文件名) 文件名=文件名.encode("cp437").decode("gbk") print(文件 阅读全文
posted @ 2020-07-16 14:02 马蹄哒哒 阅读(372) 评论(0) 推荐(0)
摘要: import os os.rename(r"E:\自动化办公",r"python处理文件路径") #修改文件夹名 os.rename(r"E:\pdf\文本.txt",r"E:\pdf\新改的名字.txt") #修改文件名 阅读全文
posted @ 2020-07-16 00:49 马蹄哒哒 阅读(243) 评论(0) 推荐(0)
摘要: import shutil import os shutil.rmtree("E:\dist") #删除文件夹 os.remove("E:\自动化办公\重新改名.txt") 阅读全文
posted @ 2020-07-16 00:43 马蹄哒哒 阅读(156) 评论(0) 推荐(0)
摘要: import shutil shutil.move(r"E:\Untitled-1.txt",r"E:\自动化办公\重新改名.txt") shutil.move("旧文件夹路径","新文件夹路径") 阅读全文
posted @ 2020-07-16 00:38 马蹄哒哒 阅读(151) 评论(0) 推荐(0)
摘要: import shutil #shutil.copytree("E:\自动化办公","E:\练习1") shutil.copytree("E:\自动化办公","E:\练习1\自动化办公") #复制"自动化办公"这个文件夹到"E:\练习1"文件夹下. 阅读全文
posted @ 2020-07-16 00:27 马蹄哒哒 阅读(3131) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 ··· 17 下一页