Lucent's Blog

Lucent's Blog

当时明月在 曾照彩云归


人生不相见,动如参与商。


Python

  1. Python查找文件并压缩

    Python查找文件并压缩

    1 min read
    Python

    代码: my = os.path.abspath(r'C:\\Users\\user\\Desktop\\新建文件夹\\111') cp = os.path.abspath(r'D:\\PicFile') if not os.path.exists(cp): os.makedirs(cp) t = 0

  2. Python解压缩

    Python解压缩

    2 min read
    Python

    解压一个.zip文件或一个目录下的所有.zip文件到指定目录。 运行方法:python unzip.py "source_dir" "dest_dir" password 参数说明: source_dir和dest_dir既可以绝对路径也可以为相对路径。 source_dir和dest_dir的缺省值表示当前目录。 password缺省表示压缩文件未加密。 代码: import sys, os, zipfile def unzip_single(src_file,

  3. Python多线程下载

    Python多线程下载

    1 min read
    Python

    import threading import time import requests from bs4 import BeautifulSoup from urllib import parse exitFlag = 0 class myThread(threading.Thread): def __init__(self, threadID, name, q): threading.Thread.__init__(self) self.threadID = threadID self.