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

python一切皆对象

时间:2019-11-16 23:07:22      阅读:65      评论:0      收藏:0      [点我收藏+]

标签:pass   pytho   函数   str   abc   Python一   int   pre   class   

类型

  • 类和函数都可以赋值给变量
#object 是顶层基类
a = 1
type(a)     #<class 'int' >
type(int)    #<class 'type'>
b = "abc"
type(b)    #<class 'str'>

class Student:
    pass

stu = Student()
type(stu)  #<class '__main__.Student'>

python一切皆对象

标签:pass   pytho   函数   str   abc   Python一   int   pre   class   

原文地址:https://www.cnblogs.com/amelie-/p/11874486.html

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