这个获取文件路径中所在的目录。
|
1
2
3
4
5
6
7
|
In [1]: import os
In [2]: os.__file__
Out[2]: '/usr/lib/python2.7/os.pyc'
In [3]: os.path.dirname(os.__file__)
Out[3]: '/usr/lib/python2.7'
|
这个获取文件路径中所在的目录。
|
1
2
3
4
5
6
7
|
In [1]: import os
In [2]: os.__file__
Out[2]: '/usr/lib/python2.7/os.pyc'
In [3]: os.path.dirname(os.__file__)
Out[3]: '/usr/lib/python2.7'
|
相关文章: