我无法使用python中的os.listdir((方法列出Windows中的远程目录。当我尝试运行下面的代码时,它说 - FileNotFoundError: [WinError 3] 系统找不到指定的路径。下面是代码-
newList = os.listdir('\\servername\d$\J2EE\IE\FOIS\jboss-4.2.3.GA\server\all\tmp')
您需要为远程 PC 中的文件夹添加"r"属性。
例如:newList = os.listdir(r"\servernamed$J2EEIEFOISjboss-4.2.3.GAserveralltmp\")