[英]How to run python from a network machine to local host?
I've a python script in the network machine, I can open the network through explorer and have access to the script. 我在网络计算机中有一个python脚本,我可以通过资源管理器打开网络并可以访问该脚本。 Through that script from network,I want to create some folders/files and write/read some files in my localhost.
通过网络中的脚本,我想在本地主机中创建一些文件夹/文件并写入/读取一些文件。 Is there a way to do this in python?
有没有办法在python中做到这一点?
The good part is: you have read access on the script. 好消息是:您对该脚本具有读取权限。
What you need is a python installation on your local machine and preferably a drive letter mapping to the script's folder. 您需要在本地计算机上进行python安装,最好是将驱动器号映射到脚本的文件夹。 If not already mapped, this can be scripted with
net use <letter>: \\\\<remote host>\\<shared folder>
. 如果尚未映射,则可以使用
net use <letter>: \\\\<remote host>\\<shared folder>
编写脚本。
Then it's as easy as cd <letter>:\\<path>\\ ; python <script>.py
然后就像
cd <letter>:\\<path>\\ ; python <script>.py
cd <letter>:\\<path>\\ ; python <script>.py
. cd <letter>:\\<path>\\ ; python <script>.py
Then to the output of the script. 然后到脚本的输出。 Apparently it creates files.
显然,它创建文件。 Can you supply the target folder on the script's command line?
您可以在脚本的命令行中提供目标文件夹吗? In that case just supply a local path.
在这种情况下,只需提供本地路径即可。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.