Python 內建函數
顯示局部符號表:
x = locals() print(x)
運行實例
locals() 函數將局部符號表作為字典返回。
符號表包含有關當前程序的必要信息。
locals()
無參數
獲取當前程序的文件名:
x = locals() print(x["__file__"])