Skip to content

common package and module in Python

  • 命令行:click, argparse

  • 并发:concurrent

  • 交互密码:getpass

  • 外部命令:subprocess, sh

  • 解析配置文件:configparse

  • 文件复制:shutil

import shutil
# Copy src to dst. (cp src dst)
shutil.copy(src, dst)
# Copy files, but preserve metadata (cp -p src dst)
shutil.copy2(src, dst)
# Copy directory tree (cp -R src dst)
shutil.copytree(src, dst)
# Move src to dst (mv src dst)
shutil.move(src, dst)



  1. License under CC BY-NC 4.0
  2. Copyright issue feedback, replace # with @
  3. Not all the commands and scripts are tested in production environment, use at your own risk
  4. No privacy information is collected here
Try iOS App