Python sys module

Source: Internet
Author: User
#! /usr/bin/env python
#-*-Coding:utf-8-*-
Import Sys
#sys模块包含了与Python解释器和它的环境有关的变量, Functions.
#1. SYS.ARGV gets the argument list for the currently executing command-line argument (list)
For I in SYS.ARGV:
Print (i)
Print (Sys.argv[0])

#2. Sys.platform get the platform for the current execution environment
Print (Sys.platform)

#3. Sys.path Module Path list
Print (Sys.path)
#添加模块路径到列表
Sys.path.insert (0, ' test ') # can also be used append

#4. Sys.builtin_module_names the name of the built-in module
Print (Sys.builtin_module_names)

#5. Sys.exit (n) Exit procedure normal exit exit (0)
# parameter is not 0 o'clock, a Systemexit exception is thrown, which allows the exception to be caught in the main program

#6. Sys.version get version information for Python interpreter
Print (sys.version)

#7. sys.maxsize the largest int value
Print (sys.maxsize)

Python sys module

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.