sys.argv[]
时间: 2023-10-06 22:11:48 浏览: 77
Python小tips
sys.argv[]是一个用于获取命令行参数的列表。它包含了在运行Python脚本时传递给脚本的所有参数。通常,sys.argv表示脚本本身的文件路径,而后续的元素则代表传递给脚本的其他参数。例如,在运行"python test.py hello"这个命令时,sys.argv表示"test.py",而sys.argv表示"hello"。通过使用sys.argv,我们可以在脚本中获取并处理这些命令行参数。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [Python 中 sys.argv 用法详解](https://blog.csdn.net/fancynthia/article/details/126271660)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
- *3* [python sys.argv[]用法](https://blog.csdn.net/u010987458/article/details/77469719)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文