python如何给路径添加一个‘‘

it2023-06-09  77

语法错误:

file = '1.ts' os.path.exists(os.getcwd() + "\钉钉ts视频2\" + file) # 或者 os.path.exists(os.getcwd() + "\钉钉ts视频2\\" + file) # 或者 os.path.exists(os.getcwd() + r"\钉钉ts视频2\" + file)

正确用法:

file = '1.ts' os.path.exists(os.getcwd() + "\钉钉ts视频2" + f'\{file}')
最新回复(0)