class - sys

最後更新: 2015-10-12

Sys Class

 

This module provides access to some variables used or maintained by the interpreter

 


import

import sys

sys.exit(0)

Exit code:  0

sys.version_info

sys.version_info(major=2, minor=7, micro=6, releaselevel='final', serial=0)

sys.argv

The list of command line arguments passed to a Python script. argv[0] is the script name

Code:

test.py

import sys

print sys.argv
print len(sys.argv)

./test.py 123 456

['./test.py', '123', '456']
3