Python 调.exe 程序并传参

2015-04-16 14:31:45 +08:00
 xxer

win环境下,python调.exe,并需要python向.exe传递几个参数(包括地址参数等),求教怎么处理。

4922 次点击
所在节点    Python
4 条回复
zhipeng
2015-04-16 15:50:23 +08:00
marchon
2015-04-16 15:53:24 +08:00
推荐用subprocess.Popen
xxer
2015-04-16 19:26:01 +08:00
@marchon 请问传参该如何处理?能否举例一下啊?
quadpixels
2015-04-16 21:09:30 +08:00
@xxer
在Linux下是这样的(程序名和参数存在一个列表里);在Windows下应该也差不多吧
``pipe = subprocess.Popen(["ls", "-l", "."], shell=False, env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE)``

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/184137

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX