One, sys module
SYS is a "standard library" of Python, which is the official "module", a shorthand for "system" that encapsulates information and interfaces for some systems.
Official documentation Reference: https://docs.python.org/2/library/sys.html
Document reference in the Chinese version: http://xukaizijian.blog.163.com/blog/static/170433119201111625428624/
Second, SYS.ARGV parameters
Sys.argv[] is used to get command line arguments, Sys.argv[0] represents the code itself file path, so the parameters starting from 1, the following two examples illustrate:
1. A simple example of using sys.argv[]:
The following is the sample1.py file:
import Sys,os print (SYS.ARGV) #打印输出命令行执行参数列表.
Os.system (sys.argv[1]) #打印输出 "system command Execution Results"
This example Os.system receive command line arguments, run parameter directives, cmd command line with parameters run Python sample1.py notepad, will open Notepad program
2. Operation result
Python function Learning sys.argv[1]