相关疑难解决方法(0)

dir并且不帮助在python中显示对象的所有属性?

到目前为止这是我的代码,

import win32com.client as winc

outlook = winc.Dispatch("Outlook.Application").GetNamespace("MAPI")
inbox = outlook.GetDefaultFolder(6)
messages = inbox.Items
message = messages.GetLast()
print message.body
Run Code Online (Sandbox Code Playgroud)

message.body从outlook打印我的最后一封电子邮件.

当我dir(message)help(message)属性body没来.为什么?

>>> dir(message)
['_ApplyTypes_', '_FlagAsMethod', '_LazyAddAttr_', '_NewEnum', '_Release_', '__AttrToID__', '__LazyMap__', '__call__', '__doc__', '__eq__', '__getattr__', '__getitem__', '__init__', '__int__', '__len__', '__module__', '__ne__', '__nonzero__', '__repr__', '__setattr__', '__setitem__', '__str__', '_builtMethods_', '_enum_', '_find_dispatch_type_', '_get_good_object_', '_get_good_single_object_', '_lazydata_', '_make_method_', '_mapCachedItems_', '_oleobj_', '_olerepr_', '_print_details_', '_proc_', '_unicode_to_string_', '_username_', '_wrap_dispatch_']
Run Code Online (Sandbox Code Playgroud)

为什么是这样?

更新

无论如何,我可以毫无疑问地了解对象的所有属性吗?

python

5
推荐指数
1
解决办法
1475
查看次数

标签 统计

python ×1