Python: 面向对象

Python程序具有面向对象的性质,如果使用numpy库的话,其中的变量就是用ndarry的格式保存的。这种格式就是面向对象的,要查看其子属性,可以用下面的命令:

# view the type of an variable
type(obj1)
# view the children of object obj1
dir(obj1)

在python环境中查看内存中的变量可以使用与matlab一样的命令:whos, 这个命令可以列举所有变量的类型和结构大小。

posted on 2017-06-16 14:34  DocNan  阅读(205)  评论(0编辑  收藏  举报

导航