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)