sys-System-specific Configuration Interpreter Settings sys包含用于访问解释器的编译时或运行时配置设置的属性和函数. Build-time Version Information sys.version:一个字符串,包含Python解释器的版本号以及版本号和使用的编译器的额外信息.交互式解释器启动时将显示此字符串.不用从它提取版本信息,使用version_info和platform模块所提供的函数. sys.version_info:一个包…
Recall that every python module has a built_in __name__ variable that python sets to the __main__ string only when the file is run as a program,not when it's imported as library so in the python fiel if __name__ == "__main__" : .... is the top-l…
sys.argv[]是用来获取命令行参数的,是一个由该脚本自身路径和其它输入的参数组成的List.sys.argv[0]表示代码本身文件路径. 这里,当我们执行python using_sys.py we are arguments的时候,我们使用python命令运行using_sys.py模块,后面跟着的内容被作为参数传递给程序.Python为我们把它存储在sys.argv变量中.记住,脚本的名称总是sys.argv列表的第一个参数.所以,在这里,'using_sys.py'是sys.argv…
1>sys.exit() >>> import sys>>> help(sys.exit)Help on built-in function exit in module sys:exit(...) exit([status]) Exit the interpreter by raising SystemExit(status). If the status is omitted or None, it defaults to zero…