【问题标题】:What does the the output of following code snippet mean? [duplicate]以下代码段的输出是什么意思? [复制]
【发布时间】:2021-05-13 05:52:09
【问题描述】:

代码:打印(类型(ValueError)) 输出:<class 'type'>

类“类型”是什么意思! 我就是不明白?

【问题讨论】:

标签: python


【解决方案1】:

对象具有与之关联的特定类型(类)。

"henlo"str 类型。

10int 类型。

["henlo", "goodbye"]list 类型。

等等

ValueError 异常只有 type 类。没有别的了。

【讨论】:

    【解决方案2】:

    type函数返回一个type对象,表示作为参数传递的对象的类型,要获取对象的类型只能使用type(ValueError)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-03-14
      • 2014-01-05
      • 2011-08-26
      • 1970-01-01
      • 2014-01-10
      • 2018-07-07
      • 2017-06-03
      • 1970-01-01
      相关资源
      最近更新 更多