Jan-16-2019, 01:58 PM
(This post was last modified: Jan-16-2019, 02:00 PM by saisankalpj.)
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
How to display this in initial format on console.I want type of output to be again
i have function
This object contains details of a person
Now to convert this object to string.I have tried
json.dumps(object)But this gives error like
object of type "postdata" is not json serializableSo 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
class<'postdata'>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