import os
path = os.path.dirname(__file__) to get the path of .py file.
os.path.dirname returns the directory component of a pathname, __file__ is the full path of .py file.
os.path is a useful module, see the doc:
http://docs.python.org/lib/module-os.path.html
Saturday, December 1, 2007
How to get program's directory in python?
发表者
fairfox
位置在:
11:21 PM
标签: programming, python
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment