使用 Python,如何访问 Windows 网络上的共享文件夹? [英] Using Python, how can I access a shared folder on windows network?
本文介绍了使用 Python,如何访问 Windows 网络上的共享文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个文件,我想从共享文件夹中复制该文件,该文件夹位于不同系统上的共享文件夹中,但位于同一网络上.如何访问文件夹/文件?通常的 open() 方法似乎不起作用?
I have a file that I would like to copy from a shared folder which is in a shared folder on a different system, but on the same network. How can I access the folder/file? The usual open() method does not seem to work?
推荐答案
使用正斜杠指定 UNC 路径:
Use forward slashes to specify the UNC Path:
open('//HOST/share/path/to/file')
(如果您的 Python 客户端代码也在 Windows 下运行)
(if your Python client code is also running under Windows)
这篇关于使用 Python,如何访问 Windows 网络上的共享文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文