使用Python,如何访问Windows网络上的共享文件夹? [英] Using Python, how can I access a shared folder on windows network?

查看:3223
本文介绍了使用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 路径:

open('//HOST/share/path/to/file')

(如果您的Python客户端代码也在Windows下运行)

(if your Python client code is also running under Windows)

这篇关于使用Python,如何访问Windows网络上的共享文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆