python 库

来源:互联网 发布:nginx error log 关闭 编辑:程序博客网 时间:2024/05/22 04:45

python 库

0.导入

要使用python模块或者库,必须先导入.
import this
导入模块时,python依赖一个路径列表,这个路径列表就是sys.path
可以运行时修改。如:

sys.path.append('/foo/bar')

当前可导入模块列表通过sys.modules可以获取,他是一个字典

sys.modules["os"]

1. 标准库

  • atexit . 退出程序时做处理 python atexit
  • argparse 解析命令行参数
  • bitsect 二分搜索
  • calendar 日期相关
  • codecs 编码数据
  • collections 一些特别有用的数据结构
  • copy
  • csv
  • datetime
  • fnmatch
  • glob
  • io
  • json
  • logginn
  • multiprocessing
  • operator
  • os
  • random
  • re
  • select
  • shutil 提高对高级文件处理的函数
  • signal 用于处理POSIX信号
  • tempfile 提供临时创建文件和目录的函数
  • threading
  • urllib
  • uuid

2. 外部库

外部库的特点是文档化程序较低.而且会有较多的bug .需要关注点

  • python3的兼容度
  • 开发活跃度,必须fabric,活跃度就很低.

一些常用的外部库:

  • MySQLdb http://blog.csdn.net/aca_jingru/article/details/50833364
  • *
0 0