Python - 如何从服务器读取路径文件/文件夹

标签 python

如何使用 Python 从远程服务器读取文件路径? 在我的本地 PC 上,这对我来说更清楚一些。

最佳答案

参见 Reading and Writing FilesPython Tutorial ,这是新手入门的好地方。

确保在 Windows 上转义反斜杠,viz:

f=open('\\\\SERVER\\share\\file.ext', 'r')

或使用 "raw" strings :

f=open(r'\\SERVER\share\file.ext', 'r')

关于Python - 如何从服务器读取路径文件/文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4163456/

相关文章:

python - Eclipse + Pydev + twitter 库问题

python - Tensorflow只保存检查点文件,不保存其他数据

python - Pandas 中的 R lm 函数

python - 将一个数据帧中的行替换为另一个数据帧中的行(以多列作为键)

python - 如何将ros导入PyCharm

python - lambda 中生成器的行为对 future 的变化安全吗?

python - 在pygame背景中加载多个图像

python - 剪切渐变时出错

python - 如何在 Ubuntu 上自动安装 miniconda

python - 属性错误 : 'module' object has no attribute '__file__' (own module installed using pip)