python笔记--------二

tolist()方法:

  列表可通过array()转换为数组或mat()转为矩阵

  而tolist()可把数组对象或矩阵对象转为列表

  数组对象:

  array([[1, 2, 3],

       [1, 2, 3]])

  矩阵对象:

  matrix([[1, 2, 3],

        [1, 2, 3]])

  列表:

  [[1, 2, 3],[1, 2, 3]]

astype("数据类型")

  强制转换数据类型

  数据类型 = float,int,str,  bool等

__new()__与__init()__的差别:

 

  __new()__:

 

  用于创建实例

 

  __init()__:

 

  用于初始化实例

 

posted @ 2019-09-27 20:35  坏人不会飞  阅读(101)  评论(0编辑  收藏  举报