"Python module learning" SYS module

Source: Internet
Author: User

The SYS module operates as follows:

1sys.argv#implements passing parameters from outside the program to the program. 2Sys.exit ([ARG])#exit in the middle of the program, arg=0 for normal exit. 3Sys.getdefaultencoding ()#gets the system current encoding, which is generally ASCII by default. 4Sys.setdefaultencoding ()#set the system default encoding, do not see this method when executing dir (SYS), do not pass in the interpreter, can execute reload (SYS), perform setdefaultencoding (' UTF8 ') at this time, the system default encoding is set to UTF8. (See Set system default encoding)5Sys.getfilesystemencoding ()#get the file system using the encoding method, return ' MBCS ' under Windows, and return ' Utf-8 ' under Mac.6Sys.path#gets a collection of strings for the specified module's search path, which can be placed in a given path, and can be found correctly when import is in the program. 7Sys.stdin,sys.stdout,sys.stderr#stdin, stdout, and stderr variables contain stream objects that correspond to standard I/O streams. If you need more control over the output, and print doesn't meet your requirements, they're what you need. You can also replace them, and you can redirect output and input to other devices ( Device), or they are handled in a non-standard way8Sys.maxsize#gets the system maximum size9Sys.platform#gets the current system platform. TenSys.version#Get Python version OneSys.builtin_module_names#returns a list containing the names of the built-in modules ASys.modules#returns a dictionary containing the module name

"Python module learning" SYS module

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.