【发布时间】:2019-01-03 08:25:19
【问题描述】:
如果我如下创建一个类,并检查对象的类型,我会得到以下输出。
我的问题是__main__ 在这里是什么意思?
class Student(object):
pass
>>>a = Student()
>>>type(a)
<class '__main__.Student'>
还有一个问题,如果我检查 Student 类的类型,我会得到以下输出。
>>>type(Student)
<class 'type'>
<class 'type'> 在这里是什么意思?
【问题讨论】:
-
您在发帖之前尝试过googling and reading documentation 吗?
-
我以前读过。我有两个问题。请仔细阅读。另外,我不太确定这里的_main_是否与文档中的相同。
标签: python python-3.x python-2.7