当前位置:网站首页>sys.argv
sys.argv
2022-07-06 08:19:00 【不求大富大贵只求富可敌国】
sys.argv可以从命令行获取参数,执行脚本。
import os
import sys
root=os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(root)
print("sys_test.argv: ",sys.argv)
print("sys_test.argv[0]: ",sys.argv[0])
print("sys_test.argv[1]: ",sys.argv[1])
print("sys_test.argv[2]: ",sys.argv[2])
print(len(sys.argv))
控制台输出:
C:\Users\jam96\PycharmProjects\all_module\sys_test>python a.py q w e r
sys_test.argv: ['a.py', 'q', 'w', 'e', 'r']
sys_test.argv[0]: a.py
sys_test.argv[1]: q
sys_test.argv[2]: w
5
1. 从python后面的.py文件计数
2. 从0开始计数
边栏推荐
- Go learning notes (3) basic types and statements (2)
- 化不掉的钟薛高,逃不出网红产品的生命周期
- Data governance: data quality
- Personalized online cloud database hybrid optimization system | SIGMOD 2022 selected papers interpretation
- MFC sends left click, double click, and right click messages to list controls
- 让学指针变得更简单(三)
- 1202 character lookup
- "Designer universe" APEC design +: the list of winners of the Paris Design Award in France was recently announced. The winners of "Changsha world center Damei mansion" were awarded by the national eco
- Use Alibaba icon in uniapp
- TiDB备份与恢复简介
猜你喜欢

ESP系列引脚說明圖匯總

2.10transfrom attribute
![[research materials] 2022 enterprise wechat Ecosystem Research Report - Download attached](/img/35/898a8086bc35462b0fcb9e6b58b86b.jpg)
[research materials] 2022 enterprise wechat Ecosystem Research Report - Download attached

Online yaml to CSV tool

Pyqt5 development tips - obtain Manhattan distance between coordinates

IP lab, the first weekly recheck

Analysis of pointer and array written test questions

The resources of underground pipe holes are tight, and the air blowing micro cable is not fragrant?
![[secretly kill little partner pytorch20 days -day01- example of structured data modeling process]](/img/ae/4e616882f6d68acdf8e885843e68a3.jpg)
[secretly kill little partner pytorch20 days -day01- example of structured data modeling process]

化不掉的钟薛高,逃不出网红产品的生命周期
随机推荐
Artcube information of "designer universe": Guangzhou implements the community designer system to achieve "great improvement" of urban quality | national economic and Information Center
leetcode刷题 (5.29) 哈希表
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
C语言自定义类型:结构体
All the ArrayList knowledge you want to know is here
logback1.3. X configuration details and Practice
Common functions for PHP to process strings
面向个性化需求的在线云数据库混合调优系统 | SIGMOD 2022入选论文解读
Restore backup data on S3 compatible storage with br
Upgrade tidb operator
从 CSV 文件迁移数据到 TiDB
Nft智能合约发行,盲盒,公开发售技术实战--拼图篇
Introduction to backup and recovery Cr
Résumé des diagrammes de description des broches de la série ESP
1. Color inversion, logarithmic transformation, gamma transformation source code - miniopencv from zero
[research materials] 2022 China yuancosmos white paper - Download attached
使用 Dumpling 备份 TiDB 集群数据到兼容 S3 的存储
[research materials] 2022 enterprise wechat Ecosystem Research Report - Download attached
[luatos-air551g] 6.2 repair: restart caused by line drawing
Data governance: Data Governance under microservice architecture