Linked Questions
12 questions linked to/from How do I look inside a Python object?
-1 votes
1 answer
183 views
Why does "wmi.WMI()" print "<_wmi_namespace: <COMObject winmgmts:>>"? [duplicate]
When run wmi.WMI() I am getting this "<_wmi_namespace: >" anyone explain this? import wmi c = wmi.WMI() output: <_wmi_namespace: <COMObject winmgmts:>> Can anyone ...
1534 votes
32 answers
1.4m views
Is there a built-in function to print all the current properties and values of an object?
So what I'm looking for here is something like PHP's print_r function. This is so I can debug my scripts by seeing what's the state of the object in question.
490 votes
25 answers
632k views
How do I get list of methods in a Python class?
I want to iterate through the methods in a class, or handle class or instance objects differently based on the methods present. How do I get a list of class methods? Also see: How can I list the ...
504 votes
10 answers
396k views
What is a Python equivalent of PHP's var_dump()? [duplicate]
When debugging in PHP, I frequently find it useful to simply stick a var_dump() in my code to show me what a variable is, what its value is, and the same for anything that it contains. What is a good ...
73 votes
10 answers
97k views
Reason for globals() in Python?
What is the reason of having globals() function in Python? It only returns dictionary of global variables, which are already global, so they can be used anywhere... I'm asking only out of curiosity, ...
25 votes
5 answers
59k views
Python. Get structure from a data.frame
In r, with the str() function you can see structure from an object like this: > str(mari) 'data.frame': 25834 obs. of 6 variables: $ Xcoor: num 0.0457 0.0469 0.0481 0.0495 0.0519 ... $ Ycoor:...
-2 votes
1 answer
2k views
Inspecting Python Objects
I am looking at a code given to me by a co-worker who no longer works with us. I have a list variable called rx. >> type(rx) type 'list' When I go to look inside rx[0] I get this: >> ...
4 votes
1 answer
1k views
How to inspect Python objects in similar way like JS objects in Chrome dev console?
In Chrome development console one can type name of a variable and output is a visual and interactive representation of the object. (In JavaScript objects are like dictionaries, so this is easy.) I ...
0 votes
1 answer
913 views
Attribute error in urls.py
I am doing the django tutorial so I am literally cutting and pasting code. I keep getting this error on step 1 from django.conf.urls import url from django.conf.urls import include from . import ...
-2 votes
1 answer
600 views
How can I use gkeepapi to retrieve and print out the labels associated with my Google Keep notes?
Background I am using gkeepapi to get the labels of my Google Keep notes: import gkeepapi keep = gkeepapi.Keep() keep.login('[email protected]', 'password') labels = keep.labels() I want to read the ...
0 votes
1 answer
79 views
speech recognition not recognising on internal mic
I was making my personal assistant speech_recognition is working properly with headphones but without headphones on internal mic it is not recognising the voice. Code: with sr.Microphone() as source: ...
0 votes
0 answers
87 views
Printing a Django model instance only shows one attribute [duplicate]
I am trying to return an object from a database in Django. So I have this line in my views.py: single_appointment = Appointment.objects.get(id=int(app_id)) app_id is passed into the view as an ...