
[英]passing arguments from php to python using shell_exec from browser
[英]Passing arguments to exec from python shell
我正在使用python shell启动python脚本。 我正在使用以下命令exec(open(“ G:\\ Yowsup \\ src \\ yowsup-cli”)。read())
问题是我需要传递一些这样的参数,但是我不知道正确的语法$ python yowsup-cli -c config.example -r sms
如何使用Python 3做到这一点?
编辑请注意,我不了解python,也不会学习它,我只需要在yowsup上运行并进行测试
$ python test.py arg1 arg2 arg3
然后,您可以像这样访问脚本中的arg:
#!/usr/bin/python
import sys
print 'Number of arguments:', len(sys.argv), 'arguments.'
print 'Argument List:', str(sys.argv)
它们作为列表存储在sys.argv
中( sys.argv[0]
= arg1
等。)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.