python内置方法、模块讲解(二十一)

  • 2016-05-20 22:58:23
  • 1105
  • 0

五十七、open方法

​1、定义:

open(...)
    open(name[, mode[, buffering]]) -> file object

    Open a file using the file() type, returns a file object.  This is the
    preferred way to open a file.  See file.__doc__ for further information.

​2、解释:用file函数类型打开一个文件并返回一个文件对象。这个方法是打开一个文件的首先方法。

​3、举例:(略)

(以下省略)

阅读更多

python内置方法、模块讲解(二十)

  • 2016-05-19 22:14:55
  • 1065
  • 0

五十二、memoryview方法(略)

用于查看一个对象的内存地址

五十三、min方法(略)

(以下省略)

阅读更多

python内置方法、模块讲解(十九)

  • 2016-05-18 21:23:28
  • 1154
  • 0

五十、map方法

1、定义:

map(...)
    map(function, sequence[, sequence, ...]) -> list

    Return a list of the results of applying the function to the items of
    the argument sequence(s).  If more than one sequence is given, the
    function is called with an argument list consisting of the corresponding
    item of each sequence, substituting None for missing values when not all
    sequences have the same length.  If the function is None, return a list of
    the items of the sequence (or a list of tuples if more than one sequence).

2、解释:返回由function方法处理过sequence每个元素的列表。若传入多个sequence时, 则分别从这些sequence中取出同序列号的元素作为一个list传入到function中。

                对于长度不够的sequence 以None代替从该sequence中取出的值。如果function为None, 则返回由这些sequence中取出同序列号的元素组成的list。

(以下省略)

阅读更多