How do I get the variable part of type as a string?
ie:
>>> type('abc')
<type 'str'>
>>> type(1)
<type 'int'>
>>> type(_)
<type 'type'>
In each case here, I want what is inside single quotes: str, int, type as a string.
I tried using a regex against repr(type(1)) and that works, but that does not seem robust or Pythonic. Is there a better way?
You can get the name by
type(1).__name__