Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/339.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python方法_Python_Python 2.7_Intellisense - Fatal编程技术网

Python方法

Python方法,python,python-2.7,intellisense,Python,Python 2.7,Intellisense,我已经为excel创建了一个对象 现在我想知道对象x1App可用的方法列表 当我打印目录时(x1App)。我得到以下清单 from win32com.client import Dispatch x1App = Dispatch("Excel.Application") 但列表中没有显示“工作簿”的位置 在创建对象x1App之后。我想添加工作簿。为什么不显示工作簿您需要自己创建早期绑定。在PythonWin GUI应用程序中,转到菜单: ['_ApplyTypes_', '_FlagAsMe

我已经为excel创建了一个对象

现在我想知道对象x1App可用的方法列表

当我打印目录时(x1App)。我得到以下清单

from win32com.client import Dispatch

x1App = Dispatch("Excel.Application")
但列表中没有显示“工作簿”的位置


在创建对象x1App之后。我想添加工作簿。为什么不显示工作簿

您需要自己创建早期绑定。在PythonWin GUI应用程序中,转到菜单:

['_ApplyTypes_', '_FlagAsMethod', '_LazyAddAttr_', '_NewEnum', '_Release_', '__ArToID__', '__LazyMap__', '__call__', '__doc__', '__eq__', '__getattr__', '__getem__', '__init__', '__int__', '__len__', '__module__', '__ne__', '__nonzero__, '__repr__', '__setattr__', '__setitem__', '__str__', '_builtMethods_', '_enum, '_find_dispatch_type_', '_get_good_object_', '_get_good_single_object_', '_lydata_', '_make_method_', '_mapCachedItems_', '_oleobj_', '_olerepr_', '_printetails_', '_proc_', '_unicode_to_string_', '_username_', '_wrap_dispatch_']

从长列表中选择要使用的Excel版本并触发生成。这可能需要几秒钟。现在您应该可以得到更好的属性建议了。

猜测一下,这看起来像是一个COM组件,COM QueryInterface方法可能是通过
\uuuu getattr\uuuuu
动态处理的(当您访问一个属性而找不到它时会调用它);在您尝试访问给定名称之前,它实际上不会知道它是否存在,也不会显示在
\uuuuu dir\uuuu
列表中。是。这是一个COM组件如果您试图操作Excel工作簿,我建议您使用一个Pthon库、/,或(其他库可用)。正如您所发现的,Excel的COM界面上的文档很难找到……我尝试了相同的方法,但仍然没有显示“工作簿”。我在下面添加了两个库。Microsoft Excel 12.0对象库(1.6)Microsoft Excel 5.0对象库(1.0),但仍然不显示“工作簿”
Tools --> COM MakePy Utility