官术网_书友最值得收藏!

Sys.argv

The sys module is used to access command-line parameters. The len(sys.argv) function contains the number of arguments. To print all of the arguments, simply execute str(sys.argv). Let's have a look at an example: 

01.py
import sys
print('Number of arguments:', len(sys.argv))
print('Argument list:', str(sys.argv))

Output:
Python3 01.py img
Number of arguments 2
Arguments list: ['01.py', 'img']
主站蜘蛛池模板: 如皋市| 调兵山市| 巴东县| 白玉县| 林芝县| 义马市| 辽中县| 兴文县| 南雄市| 报价| 田东县| 报价| 白城市| 霍邱县| 江口县| 吉木萨尔县| 湘西| 砀山县| 九江市| 扎囊县| 措美县| 弥勒县| 建水县| 通渭县| 商南县| 宁南县| 宁陵县| 中阳县| 岳普湖县| 九江县| 金坛市| 乌鲁木齐市| 来宾市| 三门县| 临猗县| 城口县| 闽侯县| 伽师县| 汶上县| 石楼县| 滁州市|