Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 type of object as a string
i need to get the type of an object as a string, as in [] -> 'list'. does anything already exist for this or do i need to use my own function?

def typestr(obj):
    return str(type(obj)).split("'")[1]
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Skaperen and Gribouillis like this post

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  AttributeError: type object 'FunctionNode' has no attribute '_TestValidateFuncLabel__ binhduonggttn 0 36 Today, 11:29 AM
Last Post: binhduonggttn
  TypeError: size; expecting a recognized type filling string dict a11_m11 0 109 Feb-10-2020, 08:26 AM
Last Post: a11_m11
  Type hinting - return type based on parameter micseydel 2 119 Jan-14-2020, 01:20 AM
Last Post: micseydel
  Object of type set is not JSON serializable enigma619 5 604 Dec-19-2019, 03:30 PM
Last Post: enigma619
  Object of type Scoreboard is not JSON serializable lsepolis123 9 2,811 Aug-13-2019, 11:22 AM
Last Post: lsepolis123
  Object and type class Uchikago 2 257 Jul-28-2019, 10:35 AM
Last Post: DeaD_EyE
  Object type of Node to json bhojendra 4 694 Apr-28-2019, 01:36 PM
Last Post: bhojendra
  TypeError: object of type 'NoneType' has no len() - what do it mean? leviathan54 4 2,606 Apr-20-2019, 12:04 PM
Last Post: leviathan54
  Getting error "Type error-a bytes-like object..." mrapple2020 1 2,045 Apr-06-2019, 06:37 PM
Last Post: mrapple2020
  scatter plot error - possibly data type - TypeError: nan is not a string chudson 1 1,739 Mar-24-2019, 11:48 AM
Last Post: chudson

Forum Jump:

Users browsing this thread: 1 Guest(s)