python打开一个本地目录文件路径

 

os.path.abspath()
os 模块为 python 语言标准库中的 os 模块包含普遍的操作系统功能。主要用于操作本地目录文件。path.abspath()方法用于获取当前路径下的文件。

比如:

file_path = 'file:///' + os.path.abspath('checkbox.html')
driver.get(file_path)

 

posted @ 2016-03-24 11:34  爬虫上的雪碧  阅读(3773)  评论(0编辑  收藏  举报