Python Forum
Python Forum
>
General
>
News and Discussions
> get type of a value as a simple string
Full Version:
get type of a value as a simple string
You're currently viewing a stripped down version of our content.
View the full version
with proper formatting.
Skaperen
May-01-2020, 11:57 PM
what is the
best way
to get just a string for the type of a value? would this be sufficient?
ts = str(type(foo)).split("'")
perfringo
May-02-2020, 12:10 PM
If I understand correctly objective then one can do:
>>> foo = 'abc' >>> type(foo).__name__ 'str'
Python Forum
>
General
>
News and Discussions
> get type of a value as a simple string