发布网友 发布时间:2022-04-23 21:27
共1个回答
热心网友 时间:2022-05-11 00:57
In[4]: a = {'a':1, 'b':2}
In[5]: vars(a)
Traceback (most recent call last):
File "C:\Users\Daimon\env\xiluapi\lib\site-packages\IPython\core\interactiveshell.py", line 2885, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-5-acc8b5e1a2ae>", line 1, in <mole>
vars(a)
TypeError: vars() argument must have __dict__ attribute
In[16]: import werobot.client as client
In[18]: c = client.Client(appid='', appsecret='')
In[19]: vars(c)
Out[19]: {'_token': None, 'appid': '', 'appsecret': '', 'token_expires_at': None}
这个vars比dir啥的好使
看来dict用json,object就用vars看哦