>>> import os
>>> homedir = os.getcwd()
>>> print homedir
D:\python\test

>>>

>>> import sys
>>> print sys.argv[0]
D:\python\test\temp.py
>>> print os.path.abspath(sys.argv[0])
D:\python\test\temp.py
>>>

posted on 2014-06-24 15:10  知识天地  阅读(12310)  评论(0编辑  收藏  举报