The Python Standard Library has a lot of modules! To help you get familiar with what's available, here are a selection of our favourite Python Standard Library modules and why we use them!

  • csv: very convenient for reading and writing csv files
  • collections: useful extensions of the usual data types including OrderedDictdefaultdict and namedtuple
  • random: generates pseudo-random numbers, shuffles sequences randomly and chooses random items
  • string: more functions on strings. This module also contains useful collections of letters like string.digits(a string containing all characters with are valid digits).
  • re: pattern-matching in strings via regular expressions
  • math: some standard mathematical functions
  • os: interacting with operating systems
  • os.path: submodule of os for manipulating path names
  • sys: work directly with the Python interpreter
  • json: good for reading and writing json files (good for web work)

How to import:

from module_name import object_name as different_name

for example:

from csv import reader as csvreader

[Python] Python Libs的更多相关文章

  1. python --- Python中的callable 函数

    python --- Python中的callable 函数 转自: http://archive.cnblogs.com/a/1798319/ Python中的callable 函数 callabl ...

  2. Micro Python - Python for microcontrollers

    Micro Python - Python for microcontrollers MicroPython

  3. 从Scratch到Python——python turtle 一种比pygame更加简洁的实现

    从Scratch到Python--python turtle 一种比pygame更加简洁的实现 现在很多学校都开设了Scratch课程,学生可以利用Scratch创作丰富的作品,然而Scratch之后 ...

  4. 从Scratch到Python——Python生成二维码

    # Python利用pyqrcode模块生成二维码 import pyqrcode import sys number = pyqrcode.create('从Scratch到Python--Pyth ...

  5. [Python]Python 使用 for 循环的小例子

    [Python]Python 使用 for 循环的小例子: In [7]: for i in range(5): ...: print "xxxx" ...: print &quo ...

  6. [python]python 遍历一个list 的小例子:

    [python]python 遍历一个list 的小例子: mlist=["aaa","bbb","ccc"]for ss in enume ...

  7. [Python]Python日期格式和字符串格式相互转换

    由字符串格式转化为日期格式的函数为: datetime.datetime.strptime() 由日期格式转化为字符串格式的函数为: datetime.datetime.strftime() # en ...

  8. [python]Python 字典(Dictionary) update()方法

    update() 函数把字典dict2的键/值对更新到dict里.如果后面的键有重复的会覆盖前面的语法dict.update(dict2) dict = {'Name': 'Zara', 'Age': ...

  9. [python]python try异常处理机制

    #python的try语句有两种风格 #一:种是处理异常(try/except/else) #二:种是无论是否发生异常都将执行最后的代码(try/finally) try/except/else风格 ...

随机推荐

  1. codevs1052

    题目地址:http://codevs.cn/problem/1053/ 分析: 模拟 代码: var s:string; a:array['a'..'z'] of longint; i,j,t,n:l ...

  2. java基本数据类型复习

    1.基本取值范围及对应封装器(参考:http://www.cnblogs.com/Free-Thinker/p/4573068.html): 简单类型 boolean byte char short ...

  3. 84.Node.js -Mongoose 方法

    转自:https://www.cnblogs.com/chris-oil/p/9136534.html Mongoose 参考手册 标签(空格分隔): MongoDB Mongoose 是什么? 一般 ...

  4. WebRTC Native APIs

    WebRTC Native APIs The WebRTC Native APIs implementation is based on W3C’s WebRTC 1.0: Real-time Com ...

  5. mysql主从复制主服务器日志格式的区别

        statement(语句级别,从服务器直接把语句拿来执行):            影响一大片(插入很多条或修改很多条),就适合用 statement       row(行级别,从服务器直接 ...

  6. MySql中允许远程连接

    要达到这个目的需要实现两点 开通用户权限 解除本地绑定 开通用户权限 首先登陆服务器端的mysql //不使用空格可以直接登陆 mysql -u用户名 -p密码 mysql> use mysql ...

  7. C++归并算法

    #include <iostream> using namespace std; void DealWhat(int ar[],int start,int end,int b[]) { i ...

  8. iOS 开发百问(5)

    42. 警告:Multiplebuild commands for output file target引用了名字反复的资源 找到当前的target,展开之后.找到CopyBundle Resourc ...

  9. Linux 6.2配置yum本地

    yum 1.挂在iso文件 [root@localhostmedia]# mount /dev/cdrom /media 2.安装createrepo createrepo是配置YUM源的配置工具,检 ...

  10. 火狐浏览器设置bypass

    http://blog.sina.com.cn/s/blog_6f7d179e0101a60l.html 某个网段不使用代理的设置FF和IE不同,IE是用*通配符,FF是用CIDR的表示法, FF的简 ...