简体   繁体   English

如何使用参数在另一个目录上打开python脚本?

[英]How to open a python script on another directory with arguments?

I have 2 scripts working together, one script receives the IP and port to connect to a server (more than one) and calls an client script, passing the ip and port to the main(ip,port) function on the client script but how can I call the client script AND pass the ip and port? 我有2个脚本一起工作,一个脚本接收IP和端口以连接到服务器(多个服务器)并调用客户端脚本,将ip和端口传递给客户端脚本上的main(ip​​,port)函数,但是如何如何调用客户端脚本并传递IP和端口?

FEEDBACK: 反馈:

#'pushd' dosn't work with os.system, you can use:

os.chdir('directory path')
os.system('python YourScriptName.py argument1 argument2')

FEEDBACK and Answer: 反馈和答案:

#'pushd' dosn't work with os.system, you can use:

os.chdir('directory path')
os.system('python YourScriptName.py argument1 argument2')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM