8

Using PyObjC, is it possible to import a Python module, call a function and get the result as (say) a NSString?

For example, doing the equivalent of the following Python code:

import mymodule
result = mymodule.mymethod()

..in pseudo-ObjC:

PyModule *mypymod = [PyImport module:@"mymodule"];
NSString *result = [[mypymod getattr:"mymethod"] call:@"mymethod"];
4

2 に答える 2

3

よくわかりませんが、たとえばhttp://lists.apple.com/archives/Cocoa-dev/2004/Jan/msg00598.htmlで提案されているように、「Cの方法」で実行できます-または「Pyobjc」http://osdir.com/ml/python.pyobjc.devel/2005-06/msg00019.htmlのとおりです(詳細については、そのスレッドの他のすべてのメッセージも参照してください)。

于 2009-04-26T02:24:26.017 に答える