python os.path.dirname 是什么目录
这个获取文件路径中所在的目录。
|
1
2
3
4
5
6
7
|
In [1]: import osIn [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 osIn [2]: os.__file__Out[2]: '/usr/lib/python2.7/os.pyc'In [3]: os.path.dirname(os.__file__)Out[3]: '/usr/lib/python2.7' |