在Visual Studio Code中,我想在调试/运行代码时将参数(例如-i)传递给Python解释器



我开始学习Python编程,我想运行我的代码,然后使用Python Interpreter中的"-i"选项使用它。但是,当我在我的launch.json文件中定义"args":["-i"]时,-i变成了我的程序的参数。

有没有办法将"-i"作为参数传递给Visual Studio Code中的Python解释器?

例如:

# test.py
dict = [{'name': 'AA', 'price': 32.2, 'shares': 100},
{'name': 'IBM', 'price': 91.1, 'shares': 50},
{'name': 'CAT', 'price': 83.44, 'shares': 150}]

>python.exe -i test.py
>>>dict = [{'name': 'AA', 'price': 32.2, 'shares': 100},
{'name': 'IBM', 'price': 91.1, 'shares': 50},
{'name': 'CAT', 'price': 83.44, 'shares': 150}]
>>>

我不知道Python是否支持它,但请尝试使用runtimeArgs而不是Args

相关内容

最新更新