gpt4 book ai didi

python - 在 Eclipse(Pydev) 中将命令行参数传递给 Python 脚本

转载 作者:IT老高 更新时间:2023-10-28 22:23:56 25 4
gpt4 key购买 nike

我是 Python 和 Eclipse 的新手,在理解如何将命令行参数传递给在 Eclipse(Pydev) 中运行的脚本时遇到了一些困难。

The following link解释如何将命令行参数传递给 python 脚本。

将命令行参数传递给模块argecho.py(来自上面链接的代码),

#argecho.py
import sys

for arg in sys.argv: 1
print arg

我需要输入 python 控制台

[you@localhost py]$ python argecho.py             
argecho.py

[you@localhost py]$ python argecho.py abc def     
argecho.py
abc
def

如何在 Eclipse(Pydev) 中将相同的参数传递给 Python 脚本???

谢谢!

最佳答案

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

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

enter image description here

关于python - 在 Eclipse(Pydev) 中将命令行参数传递给 Python 脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4355721/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com