os.path.join()可以连接两个路径
current_path = os.path.abspath(os.curdir)
ms_script_path = os.path.join(current_path, "app/scripts/emilia_ms_scripts/")
比如:current_path =“C:\项目\项目代码\myproject”
合并后:
ms_script_path ="C:\项目\项目代码\myproject\app/scripts/emilia_ms_scripts/"
注意 要是join的某一个路径是绝对路径,则前面的参数路径就会被舍弃
比如:
current_path = os.path.abspath(os.curdir)
script_path = os.path.join(current_path, "/app/scripts/emilia_ms_scripts/")
我的代码中就会出现script_path = “C:/app/scripts/emilia_ms_scripts/”