gpt4 book ai didi

python - 无法使用 os.startfile 访问远程服务器上的文件

转载 作者:行者123 更新时间:2023-12-03 11:07:31 27 4
gpt4 key购买 nike

我正在尝试使用命令 os.startfile 访问服务器上的测试文本文件,但我似乎无法让它工作。我知道它失败只是因为文本文件在服务器上而不是在计算机上,但我不知道如何访问它。

这是我的代码:

from os import startfile
path = "//10.2.30.61/c$/Qlikview_Tropal/Raport/test1.txt"
startfile("//10.00.00.00/c$/test/test1/test1.txt")

我收到此错误:FileNotFoundError: [WinError 2]。顺便说一句,我在 Windows 上。

Update_1:我尝试了 enter os.startfile(os.path.normpath()) 并收到此错误:“filenotfounderror winerror 53 未找到网络路径”

谢谢!!

最佳答案

你可以做到

from os import start file


#put two \\ to get one \
path = "\\\\10.2.30.61\\c$\\Qlikview_Tropal\\Raport\\test1.txt"
startfile(r"\\10.00.00.00\c$\test\test1\test1.txt")

https://stackoverflow.com/a/43205543/14579156

关于python - 无法使用 os.startfile 访问远程服务器上的文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64687169/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com