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

时间:2023-03-08 19:17:55

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

比如:

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

相关文章