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
大致就是, 先确定根文件的绝对路径,
然后由此, 去确定其他文件的绝对路径
网友评论