看板 Python 關於我們 聯絡資訊
在 Extending & Embedding 的文件裡面 有教怎麼在模組當中建立 function, class, type 等等.. 但是沒有講怎麼在當中建議一個新的 '變數'.. 請問應該如何完成這個動作? 例如說 ============================================================ //main.cpp int n ; void initTest () { //請問這邊要怎麼寫? } ============================================================ 然後我可以在 Python 當中可以這樣用.. ============================================================ >>> import Test >>> Test.n = 10 10 ============================================================ 查 Google 打 python define variable in module 也跳出很多無關的東西 已經弄兩天了,先感謝前輩們的幫助 T_T -- To iterate is human, to recurse is divine. 遞迴只應天上有, 凡人該當用迴圈.   L. Peter Deutsch -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.113.129.180 ※ 編輯: yoco315 來自: 140.113.129.180 (06/16 02:47)