os.path

2018-04-09  本文已影响0人  樊海鹏
import os

_basedir = os.path.abspath(os.path.dirname(__file__))
print os.path.join(_basedir, 'wdio.conf.js')
print os.path.join(_basedir, '../README.md')
print os.getcwd()
del os
/home/fhp/test/app/wdio.conf.js
/home/fhp/test/app/../README.md
/home/fhp/test/app

其实_basedir 相当于 pwd

大致就是, 先确定根文件的绝对路径,
然后由此, 去确定其他文件的绝对路径

上一篇 下一篇

猜你喜欢

热点阅读