用python列出网络共享 [英] listing network shares with python

查看:89
本文介绍了用python列出网络共享的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我明确尝试在Windows计算机上使用python列出远程主机上共享目录的内容,则该操作成功,例如,以下代码片段可以正常工作:

if I explicitly attempt to list the contents of a shared directory on a remote host using python on a windows machine, the operation succeeds, for example, the following snippet works fine:

os.listdir("\\\\remotehost\\share")

但是,如果我尝试列出远程主机上可用的网络驱动器/目录,则python失败,以下代码片段中显示了一个示例:

However, if I attempt to list the network drives/directories available on the remote host, python fails, an example of which is shown in the following code snippet:

os.listdir("\\\\remotehost")

有人知道为什么这行不通吗?感谢任何帮助/解决方法.

Is anyone aware of why this doesn't work?, any help/workaround is appreciated.

推荐答案

可能是 pysmb 可以帮助

这篇关于用python列出网络共享的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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