我可以讓python直接打印__builtins__的源代碼嗎? OR(更優選): 什麼是__builtins__的源代碼的路徑名? 我至少知道以下幾點: __builtins__是一個模塊,通過鍵入type(__builtins__)。 我已經嘗試了最好的答案建議到這個SO問題更一般的情況:"Finding the source code for built-in Python function
我想用Python的自檢模塊inspect來檢索已使用函數函數importlib.util加載到作用域中的活動對象的源代碼。試圖在spec_file本身或spec文件中的任何函數上使用inspect.getsource()成功返回所需的源代碼。但是,用於檢索spec文件中類類型的源代碼的相同方法會拋出TypeError: None is a built-in class。 from importl