【问题标题】:How to pass command line argument to python using eclipse [duplicate]如何使用eclipse将命令行参数传递给python [重复]
【发布时间】:2012-10-04 20:01:26
【问题描述】:

可能重复:
Passing command Line argument to Python script within Eclipse(Pydev)

我有一个包含以下行的 python 脚本:

reportIP(sys.argv[1])

当我运行代码时,我收到以下错误:

IndexError: list index out of range

我知道有一个参数需要传递。如果我在添加 PyDev 后从 eclipse 运行我的代码,我该怎么做?请尽量详细一点。

【问题讨论】:

    标签: python


    【解决方案1】:

    来自https://stackoverflow.com/a/4355739/1204143Andrew White

    点击工具栏中的播放按钮向下箭头->运行配置->(双击)Python运行->右侧的参数选项卡。

    您可以从那里填写程序参数文本框。

    【讨论】:

      猜你喜欢
      • 2018-10-16
      • 2014-04-27
      • 2011-05-20
      • 1970-01-01
      • 1970-01-01
      • 2011-06-19
      • 1970-01-01
      • 2013-10-11
      • 1970-01-01
      相关资源
      最近更新 更多