【发布时间】:2011-11-11 14:34:23
【问题描述】:
我有以下几点:
% more a.py
import os
os.system('pwd')
% python a.py
/Users/yl/test/f
% cd ..
% python ./f/a.py
/Users/yl/test
基本上我希望最后一个输出是“/Users/yl/test/f”,这是脚本所在的路径(不是调用 python 的位置)。玩过,但没有找到好的解决方案。感谢您的任何建议!
【问题讨论】:
标签: python