The SYS module of Python

Source: Internet
Author: User
Tags stdin

I. INTRODUCTION

The SYS module is used to provide actions related to the Python interpreter.

Two. Common functions
SYS.ARGV command line parameter list, the first element is the program itself path Sys.modules returns the System Import module field, key is the module name, value is the module sys.exit (n) exit program, exit normally exits (0) sys.version Gets the version information of the Python interpreter sys.maxint the largest int value Sys.path returns the search path of the module, using the value of the PYTHONPATH environment variable when initializing Sys.platform returns the operator Make system platform name Sys.stdout.write (' please: ') val = Sys.stdin.readline () [: -1]sys.modules.keys () Returns all imported module names Sys.modules.values () returns all imported modules Sys.exc_info () Gets the exception class currently being processed, Exc_type, Exc_value, exc_        Traceback the exception details currently handled Sys.exit (n) exit the program, exit normally (0) Sys.hexversion get the version value of the Python interpreter, 16 binary format such as: 0x020403f0sys.version The API version of C for the Sys.api_version interpreter that gets the Python interpreter sys.version_info ' final ' means final, there is also ' candidate ' for the candidate, serial for the version level, and whether there is a successor to the release Sys. Displayhook (value) if value is not NULL, the function will output it to sys.stdout and save him in __builtin__._. In Python's interactive interpreter, ' _ ' represents the result of the last input you entered, Hook is the meaning of the hook, the last results hooked sys.getdefaultencoding () return the current default character encoding format you use Sys.getfilesystemencoding () Returns the encoding of the Unicode file name to the system file name Sys.setdefaultencoding (name) is used to set the current default character encoding, if name and any one of the available encodings do not match, throw Lookuperror, This function will only be sitecust by the site module.Omize use, once the site module is used, he will remove the Sys.builtin_module_names Python interpreter imported module list from the SYS module sys.executable python interpreter path Sys.get WindowsVersion () Gets the version of Windows Sys.copyright Records Python copyright related things sys.byteorder local byte rule indicator, Big-endian platform value is ' big ', Litt         The value of the Le-endian platform is ' little ' sys.exc_clear () is used to clear the current or most recent error message that occurs on the current thread Sys.exec_prefix returns the location of the platform standalone Python file installation Sys.stderr Error output Sys.stdin standard input sys.stdout standard output Sys.platform returns the operating system platform name Sys.path returns the search path for the module, using PYTHONPA when initializing The value of the TH environment variable Sys.maxunicode the largest Unicode value sys.maxint the largest int value sys.version gets the version information of the Python interpreter sys.hexversion get P Ython version value of the interpreter, 16 binary format such as: 0x020403f0

  

The SYS module of Python

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.