Get a "type" return as a human-readable string
How to get the variable part of type as a string?
t
>>> type('abc') <type 'str'> >>> type(1) <type 'int'> >>> type(_) <type 'type'> In each case, here I want what's inside single quotes: str, int, type as a string.
I tried using regex against repr(type(1)) and it works, but it doesn't seem reliable or Pythonic. Is there a better way?
+6
user688635
source share