让
x = [1,2,3]
然后在ipython,我得到以下
> In [8]: type(x)
Out[8]: list
>
> In [9]: print(type(x))
<class 'list'>
为什么不 print(type(x)) 只是打印列表,而不是额外的类的东西?
一个相关的问题是,如何显示输出
type of x is; list
print(' type of x is: ', type(x)) 不这样做是因为我得到了额外的课程内容,例如
In [2]: print(' type of x is: ', type(x))
type of x is: <class 'list'>