Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 General query regarding conversion of dict to class object
i have a object of type class<'postdata'>
This object contains details of a person
Now to convert this object to string.I have tried
But this gives error like
object of type "postdata" is not json serializable
So i have tried
json.loads(json.dumps(object,default=lambda x: x.__dict__))
The output to above statement is dictionary
How to display this in initial format on console.I want type of output to be again
Second question is
i have function
def abc():
   print("call in function abc")
so instead of writing "call in function abc",the function name should be taken dynamically,like what ever is function name ,it should print like calling that function,without us specifying abc

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  How to save a class object to a file? SheeppOSU 2 61 Jun-22-2019, 11:54 PM
Last Post: metulburr
  call func from dict mcmxl22 3 176 Jun-21-2019, 05:20 AM
Last Post: snippsat
  python opencv grayscale conversion error Spandora 1 290 May-26-2019, 10:43 AM
Last Post: heiner55
  Vba conversion to Python stranger14u 1 407 May-26-2019, 08:01 AM
Last Post: heiner55
  Python Script to Produce Difference Between Files and Resolve DNS Query for the Outpu sultan 2 112 May-22-2019, 07:20 AM
Last Post: buran
  General reference for Python FLAJA 1 79 May-22-2019, 06:41 AM
Last Post: heiner55
  Filter to List and/or Tuple conversion vindo 3 156 May-18-2019, 05:40 AM
Last Post: perfringo
  call dict object result key error lateublegende 2 134 May-15-2019, 01:08 PM
Last Post: lateublegende
  py2 to py3 conversion Vysero 1 106 May-14-2019, 04:05 PM
Last Post: snippsat
  How can I change value of dict in list? Mike Ru 1 93 May-13-2019, 09:06 PM
Last Post: ichabod801

Forum Jump:

Users browsing this thread: 1 Guest(s)