码迷,mamicode.com
首页 > 编程语言 > 详细

[Python] Python Libs

时间:2017-11-28 16:44:39      阅读:176      评论:0      收藏:0      [点我收藏+]

标签:ini   imp   iar   item   collect   generate   att   port   ica   

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

标签:ini   imp   iar   item   collect   generate   att   port   ica   

原文地址:http://www.cnblogs.com/Answer1215/p/7910360.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!