看板 Python 關於我們 聯絡資訊
※ 引述《yoco315 (眠月)》之銘言: : 在 Extending & Embedding 的文件裡面 : 有教怎麼在模組當中建立 function, class, type 等等.. : 但是沒有講怎麼在當中建議一個新的 '變數'.. : 請問應該如何完成這個動作? http://docs.python.org/api/moduleObjects.html#l2h-680 int PyModule_AddObject( PyObject *module, char *name, PyObject *value) Add an object to module as name. This is a convenience function which can be used from the module's initialization function. This steals a reference to value. Return -1 on error, 0 on success. New in version 2.0. int PyModule_AddIntConstant( PyObject *module, char *name, long value) Add an integer constant to module as name. This convenience function can be used from the module's initialization function. Return -1 on error, 0 on success. New in version 2.0. int PyModule_AddStringConstant( PyObject *module, char *name, char *value) Add a string constant to module as name. This convenience function can be used from the module's initialization function. The string value must be null-terminated. Return -1 on error, 0 on success. New in version 2.0. -- その乾いた哀愁の瞳に去來するものは何か? 失ったもの 得たもの そして廣大なネットの狹間で彼が見たものとは? 虛像と實存と記號の中に彼は今、何を想うのか? <バトルプログラマーシラセ> -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.109.224.64
yoco315:非常感謝 :D 06/17 23:46