-4

code: print(type(ValueError)) output: <class 'type'>

what does class 'type' mean! I just don't understand it?

  • 1
    The `type` function returns a `type` object: https://docs.python.org/3/library/functions.html#type – rdas Feb 09 '21 at 15:13

2 Answers2

0

Objects have specific types (classes) associated with them.

"henlo" is a str type.

10 is an int type.

["henlo", "goodbye"] is a list type.

and etc.

The ValueError exception just has the class of type. There's nothing else to it.

Virdan
  • 36
  • 1
  • 6
0

the type function returns a type object that express the type of the object passed as argument, to get the type of an object only use type(ValueError)

Leonardo Scotti
  • 1,069
  • 8
  • 21