0
如何运行在IDLE Windows中的脚本需要命令行参数:如何在IDLE在Windows环境下运行命令行python脚本
import sys
print('The command line arguments are:')
for i in sys.argv:
print(i)
如何运行在IDLE Windows中的脚本需要命令行参数:如何在IDLE在Windows环境下运行命令行python脚本
import sys
print('The command line arguments are:')
for i in sys.argv:
print(i)
它似乎并不像IDLE提供了一种方法做这通过GUI,但你可以这样做:
嘲笑他们在你的if __name__ == '__main__':
你拦截命令行参数。
try:
__file__
except:
sys.argv = [sys.argv[0], 'argument1', 'argument2', 'argument2']
您也可以尝试,
idle.py -r scriptname.py arg1 arg2 arg3