有時候使用外部指令來 執行 python的程式, 想要取得該程式 的 實際路徑位置 可以使用 os.path.abspath(__file__) 來獲取 路徑位置的資訊。 import os dirname, filename = os.path.split(os.path.abspath(__file__)) cf. python - Find current directory and file's directory - Stack Overflow http://stackoverflow.com/questions/5137497/find-current-directory-and-files-directory
文章標籤
全站熱搜
創作者介紹
創作者 peicheng 的頭像
peicheng

FLASHC

peicheng 發表在 痞客邦 留言(0) 人氣(57)